Re: Automatic logoff
| From: | listread | Date: | Wed, 27 Jan 2010 17:20:31 +0000 |
| Subject: | Re: Automatic logoff | ||
| References: | 1 2 3 4 5 6 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46821@lists.php.net to get a copy of this message | ||
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.