[Welcome] [TitleIndex] [WordIndex

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.

Solution

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

You can also use session2, a rewrite of the session management API for Quixote 2.x. session2 provides multiple persistent session stores, including stores for MySQL, PostgreSQL, Durus, and shelve-based databases.

Discussion

References

(These are all for Quixote 1.x...)

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


2010-09-22 22:14