Persistant dictionary with lockable elements

W

Will McGugan

Hi,

I'd like to have a persistant dictionary in a server so that incoming
requests acquire a specific Python object, do something with it then
return. There wont be that many objects but it is the persistance that
is important here, I want the information to survive server re-starts /
crashes. The Shelve module seems ideal for this, but because the server
will be multithreaded I would like to be able to lock individual
elements of the shelve while they are being processed (not just the
entire Shelve object).

Is there some way of using Shelve like this, or should I just move to a
more typical database solution?

Thanks,

Will McGugan
http://www.willmcgugan.com
 
B

Bruno Desthuilliers

Will said:
Hi,

I'd like to have a persistant dictionary in a server so that incoming
requests acquire a specific Python object, do something with it then
return. There wont be that many objects but it is the persistance that
is important here, I want the information to survive server re-starts /
crashes. The Shelve module seems ideal for this, but because the server
will be multithreaded I would like to be able to lock individual
elements of the shelve while they are being processed (not just the
entire Shelve object).

Is there some way of using Shelve like this, or should I just move to a
more typical database solution?

You may want to try with the ZODB. Or with SQLite.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top