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.4.tar.gz
(15.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ncache-0.4-py2.py3-none-any.whl
(15.4 kB
view details)
File details
Details for the file ncache-0.4.tar.gz.
File metadata
- Download URL: ncache-0.4.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9cec3de4eee9cd8b3f8a3999bffe6c144d69d32f1ba8faa236c2b25a92be3c5
|
|
| MD5 |
49d962a4969289b191adfd3ef0155c6e
|
|
| BLAKE2b-256 |
d2448694e2e65bea729066413ad5cd32a3d8581d40c6529dda7c4313e5225f15
|
File details
Details for the file ncache-0.4-py2.py3-none-any.whl.
File metadata
- Download URL: ncache-0.4-py2.py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bda5b781bd55d225efa65623bd8eaf43cc3132b00af5bcdb3946929c8db70cc5
|
|
| MD5 |
80f9ea0d01660b27fd7f4cda01f5a6b3
|
|
| BLAKE2b-256 |
735f5f1497c7fd87acd4c4c0614ff1bfb7abf3cbf81cf63f1b40a816e12a153f
|