Re: Automatic logoff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard,

I think I need to learn about semaphores! Any suggestions for a good tutorial?

One of the things we want to do is exclude locked records from a query. Will semaphores provide for that?

Thanks!

- Ron




On 1/27/2010 8:14 AM, Richard Quadling wrote:

The technique I've used in the past is semaphore locking, where the
semaphore contains the session and the expected expiry time.

Follow this.

User a starts the process of editing a record.
Set the semaphore where there is :
   a - no existing semaphore - no ongoing edits.
   b - the semaphore's session is the same - repeat edits by this user
in the same session (expired or otherwise).
   c - the semaphore has expired - the other user simply took too long.

If the semaphore cannot be set it will be because of :
   d - Different non expired session - someone else is editing the record.

When a user saves the row, you just remove the semaphore.

The semaphores could be in a separate table (rather than on the record itself).

Different tables have different number of columns so take different
amounts of time to edit, so each table would have a different amount
of time from edit to expiry.

An entry on a lookup table (just a description) should, in the main,
be completed within 30 seconds.

But a detail line for a purchase order may take several minutes.

You'll have to tune this to your own needs.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux