A simple and lightweight dictionary-based persistent cache for storing python objects.
Project description
Nano cache
A simple and lightweight dictionary-based persistent cache for storing python objects.
Installation:
pip install ncache
Usage:
from ncache import Cache
cache = Cache('my.cache')
cache.load_cache()
values = []
try:
_hash = cache.get_hash('key')
val = cache.get_value(_hash) # raise NoCacheValue exception if not found
values += [val]
print('Value got from cache:', values)
except:
# if not in cache then add it
val = {'value'}
cache.set_value(_hash, val)
values += [val]
print('Value added:', values)
cache.save_cache()
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
ncache-0.1.1.tar.gz
(2.6 kB
view hashes)
Built Distribution
ncache-0.1.1-py2.py3-none-any.whl
(14.9 kB
view hashes)
Close
Hashes for ncache-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf6146e535aa02aaa85a63e0326547c4fe7b1837f1c3c6acffa8c1bd796d218b |
|
MD5 | 7e441eeab7a0acbd88009fd8afee522a |
|
BLAKE2b-256 | c57d9ddb5b51de5c3f5645c73bb23a2ca16e5acc70e1006313e85b7fc4837063 |