From: Edward S. <ed...@gm...> - 2009-01-10 01:50:35
|
Hi I have a small yaws application that needs to store a small number (3 or 4) property values. I was hoping to find something like pythons anydb [anydbm ?] module that allows access from a property key to retrieve or set the keys value. The values will be updated during the application. Concurrent access may need to be considered but is not critical. Mensia and Dets seem overkill for my needs. Any alternative / suggestions. -- Edward Stow |
From: Davide M. <ne...@gm...> - 2009-01-10 04:06:55
|
Hi I guess you can store the property values in a simple config file. You can read the values using file:consult and writting back with Joe's unconsult(File, L) -> {ok, S} = file:open(File, write), lists:foreach(fun(X) -> io:format(S, "~p.~n",[X]) end, L), file:close(S). To enable concorrent access you can restrict access to the file to a single process (responsible for making the property values available to the remaining processes). Cheers, Davide :) On Sat, Jan 10, 2009 at 1:36 AM, Edward Stow <ed...@gm...> wrote: > Hi > > I have a small yaws application that needs to store a small number (3 > or 4) property values. > > I was hoping to find something like pythons anydb [anydbm ?] module > that allows access from a property key to retrieve or set the keys > value. > > The values will be updated during the application. > > Concurrent access may need to be considered but is not critical. > > Mensia and Dets seem overkill for my needs. > > Any alternative / suggestions. > > -- > Edward Stow > > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > _______________________________________________ > Erlyaws-list mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > |
From: Edward S. <ed...@gm...> - 2009-01-10 04:34:10
|
2009/1/10 Davide Marquês <ne...@gm...>: > Hi > > I guess you can store the property values in a simple config file. > You can read the values using file:consult and writting back with Joe's > unconsult(File, L) -> > {ok, S} = file:open(File, write), > lists:foreach(fun(X) -> io:format(S, "~p.~n",[X]) end, L), > file:close(S). > To enable concorrent access you can restrict access to the file to a single > process (responsible for making the property values available to the > remaining processes). Davide, Thanks I have implemented this for the time being pending a better alternative. -- Edward Stow |
From: Claes W. <kl...@ta...> - 2009-01-12 08:30:41
|
Edward Stow wrote: > Hi > > I have a small yaws application that needs to store a small number (3 > or 4) property values. > This is really easy, Just create an additional helper module that is using a registered process name and let that process open a dets file containing whichever dat you want to store. The process can even be started on demand, i.e. it doesn't have to be started through yaws script flags as in: lookup(Key) -> case whereis(mydb) of undefined -> register(mydb, spawn(fun() -> mydb:start() end)); _ -> _ end, mydb:lookup(Key). /klacke |
From: Claes W. <kl...@ta...> - 2009-01-12 08:35:40
|
Claes Wikström wrote: > Just create an additional helper module that is using a registered > process name and let that process open a dets file Just clarifying, 'dets' as in the OTP module dets. /klacke |