Re: [PHP] End of session clean-up
On 2011-12-03 18:14 +, Stuart Dallas wrote: Writing a session handler is pretty straightforward. I wrote about how to implement one to use MySQL a while back which I'm sure you could easily adapt to your needs. http://stut.net/2008/07/20/mysql-sessions/ Thank you. That's too much code for the amount of time I had, though. So I just added the purging of old records to the code that creates them. It's not ideal in that old records remain until someone opens a new session. But it's quicker and safer than writing a whole session handler. -- André Majorel http://www.teaser.fr/~amajorel/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] End of session clean-up
On 3 Dec 2011, at 16:57, Andre Majorel wrote: Hello all. I need to purge old records from application tables when a session expires. How do I register a callback with the end-of session-garbage collection system ? session_set_save_handler() lets me override the native garbage collection, not *add* to it, as far as I can tell. You would need to implement a complete session handler to add your own functionality into the GC. However, the fact that you want to do this begs the question, why are you storing what sounds like session data in application tables instead of storing them in the session? -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] End of session clean-up
On 2011-12-03 17:41 +, Stuart Dallas wrote: On 3 Dec 2011, at 16:57, Andre Majorel wrote: Hello all. I need to purge old records from application tables when a session expires. How do I register a callback with the end-of session-garbage collection system ? session_set_save_handler() lets me override the native garbage collection, not *add* to it, as far as I can tell. You would need to implement a complete session handler to add your own functionality into the GC. Rats. However, the fact that you want to do this begs the question, why are you storing what sounds like session data in application tables instead of storing them in the session? This session data is similar to a purchase basket. It references tuples from the static tables. If it's outside of the database, we lose the benefits of a relational DBMS. -- André Majorel http://www.teaser.fr/~amajorel/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] End of session clean-up
-Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ On 3 Dec 2011, at 18:07, Andre Majorel wrote: On 2011-12-03 17:41 +, Stuart Dallas wrote: On 3 Dec 2011, at 16:57, Andre Majorel wrote: Hello all. I need to purge old records from application tables when a session expires. How do I register a callback with the end-of session-garbage collection system ? session_set_save_handler() lets me override the native garbage collection, not *add* to it, as far as I can tell. You would need to implement a complete session handler to add your own functionality into the GC. Rats. However, the fact that you want to do this begs the question, why are you storing what sounds like session data in application tables instead of storing them in the session? This session data is similar to a purchase basket. It references tuples from the static tables. If it's outside of the database, we lose the benefits of a relational DBMS. Writing a session handler is pretty straightforward. I wrote about how to implement one to use MySQL a while back which I'm sure you could easily adapt to your needs. http://stut.net/2008/07/20/mysql-sessions/ -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php