shelve databases

Raymond Hettinger vze4rx4y at verizon.net
Fri May 23 23:03:22 EDT 2003


<soporte at prsystem.com> wrote in message
news:mailman.1053716977.23634.python-list at python.org...
> Hello:
> I have a question about the shelve module and the multiuser environment. I
> dont know how to implement a multiuser database with shelve, how to lock
> and unlock for example.

import threading, shelve

class MultiUserDict(shelve.shelve):
    dblock = threading.Lock()
      . . .
    def __setitem__(self, key, value):
        dblock.acquire(blocking=1)
        shelve.shelve.setval(self, key, value)
        dl.release()
       . . .

Raymond Hettinger






More information about the Python-list mailing list