[REBOL] Re: Multiuser database
From: Paavo::Nevalainen::saunalahti::fi at: 21-Mar-2006 14:44
I have been quite happy with semaphores.
A typical cgi app needs an expiration mechanism,
since it is very hard to guarantee any sensible logic for user
behaviour. Here is a unit test for a semaphore-handler I use.
It has to use some until -- loop -- try - disarm construct
to make it working sensibly. File based dbs have never
crashed... (I found a semaphore example from some public
source, don't remember where it was).
test: has [
semaphore-handler: make-semaphore-handler %locks/ max-period-locked
print semaphore-handler/lock 0 ; --> true
print semaphore-handler/lock/meek 0 ; ---> false
print semaphore-handler/release 0 ; --> true
Above, a non-meek lock attempt simply waits until
it succeeds. The locks are used to change the state
of objects, for example obj/state == 'free --> obj/state: 'edited .
So others can check the obj and see if it is available.
Summary: rather non-programmer guy can survive well with file dbs.