low-end persistence strategies?

Thomas Guettler guettli at thomas-guettler.de
Wed Feb 16 08:49:44 EST 2005


Am Tue, 15 Feb 2005 18:57:47 -0800 schrieb Paul Rubin:

> I've started a few threads before on object persistence in medium to
> high end server apps.  This one is about low end apps, for example, a
> simple cgi on a personal web site that might get a dozen hits a day.
> The idea is you just want to keep a few pieces of data around that the
> cgi can update.
[cut]
> Anyway, something like dbm or shelve coupled with flock-style file
> locking and a version of dbmopen that automatically retries after 1
> second if the file is locked would do the job nicely, plus there could
> be a cleanup mechanism for detecting stale locks.
> 
> Is there a standard approach to something like that, or should I just
> code it the obvious way?

Hi,

I would use the pickle module and access to the
pickle files could be serialized (one after the other
is allowed to read or write) with file locking.

This means your cgi application can only serve one request
after the other.

HTH,
 Thomas

-- 
Thomas Güttler, http://www.thomas-guettler.de/





More information about the Python-list mailing list