You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
955 B

4 years ago
  1. PickleShare - a small 'shelve' like datastore with concurrency support
  2. Like shelve, a PickleShareDB object acts like a normal dictionary. Unlike shelve,
  3. many processes can access the database simultaneously. Changing a value in
  4. database is immediately visible to other processes accessing the same database.
  5. Concurrency is possible because the values are stored in separate files. Hence
  6. the "database" is a directory where *all* files are governed by PickleShare.
  7. Example usage::
  8. from pickleshare import *
  9. db = PickleShareDB('~/testpickleshare')
  10. db.clear()
  11. print("Should be empty:",db.items())
  12. db['hello'] = 15
  13. db['aku ankka'] = [1,2,313]
  14. db['paths/are/ok/key'] = [1,(5,46)]
  15. print(db.keys())
  16. This module is certainly not ZODB, but can be used for low-load
  17. (non-mission-critical) situations where tiny code size trumps the
  18. advanced features of a "real" object database.
  19. Installation guide: pip install pickleshare