pdict has a dictionary like interface and a sqlite backend
Project description
pdict has a dictionary like interface and a sqlite backend. It uses pickle to store Python objects and strings, which are then compressed with zlib for storage in sqlite. Multithreaded interaction is supported.
Depends on python 2.5+
Example use:
>>> filename = 'cache.db'
>>> cache = pdict.PersistentDict(filename)
>>> url = 'http://google.com/abc'
>>> html = '<html>abc</html>'
>>>
>>> url in cache
False
>>> cache[url] = html
>>> url in cache
True
>>> cache[url] == html
True
>>> cache.get(url)['value'] == html
True
>>> now = datetime.datetime.now()
>>> cache.meta(url)
{}
>>> cache.meta(url, 'meta')
>>> cache.meta(url)
'meta'
>>> del cache[url]
>>> url in cache
False
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pdict-1.0.tar.gz
(3.6 kB
view details)
File details
Details for the file pdict-1.0.tar.gz.
File metadata
- Download URL: pdict-1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee2b2db11b9d7f7c7ef871979ea9c90eec4ddb02d6ca661f05551136eeb3c843
|
|
| MD5 |
3c691fa173fa17143fc422b6ee74f89c
|
|
| BLAKE2b-256 |
84e5f11a05b02ef0633c5c95847896d546031140b1b5c0d8b8457e33ee2da680
|