A simple and lightweight dictionary-based persistent cache for storing large objects.
Project description
Nano cache
A simple and lightweight dictionary-based persistent cache for storing large objects.
Install:
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
cache.set_value(_hash, val)
values += [val]
print('Value added:', values)
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.tar.gz
(1.6 kB
view hashes)
Built Distribution
ncache-0.1-py2.py3-none-any.whl
(13.7 kB
view hashes)