1. Problem

You want to store sessions in some persistent form, so that the long-running process can be killed and restarted at any point without messing up user sessions. The method for persistence in this case is a database.

2. Solution

To do this, you override the default Quixote Session and SessionHandler classes with ones that implement the persistence mechanism you choose. See below for sample implementations of this.

3. Discussion

4. References

Titus Brown has posted an example of storing sessions in an PostgreSQL database here.

Charles Brandt has posted a modified version of Titus' code that uses SQLObject as the database interface. Available here.

Ksenia Marasanova has modified the version of Charles' code for use with SQLObject 0.6.X. Available here.


CategoryCookbook