A simple key-value caching API with default implementations for an SQLite3 storage backend and a JSON convenience layer.
Project description
Note: This package is in the dangerous land of
0.x.y
versions and may be subject to breaking changes with minor version increments.
nr.caching
A simple key-value caching API with default implementations for an SQLite3 storage backend and a JSON convenience layer.
Quickstart
from nr.caching.sqlite import SqliteStore
from nr.caching.json import hash_args, JsonCacheFactory
caching_backend = SqliteStore('.cache.db')
cache_factory = JsonCacheFactory(caching_backend, default_exp=60)
data = cache_factory.namespace('my-namespace').loading(
f'expensive_function_{hash_args(parameters)}',
lambda: expensive_function(*parameters))
Copyright © 2021 Niklas Rosenstein
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
nr.caching-0.3.1.tar.gz
(6.7 kB
view details)
Built Distribution
File details
Details for the file nr.caching-0.3.1.tar.gz
.
File metadata
- Download URL: nr.caching-0.3.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b9035b9b8d4dd6be4b48632897572f8d9e4c64fb27aa8388949a4e4c125fab3 |
|
MD5 | 30040646edc4cf8fd186c348196a416f |
|
BLAKE2b-256 | 516a51e22c270e49d29358e9df30bb2cf803c374975433682199fe89646b08ee |
File details
Details for the file nr.caching-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: nr.caching-0.3.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6706ee65cf0578d82d37ef916fbc211fe2f2a49f5e0ff41597036d48e0fc5fd6 |
|
MD5 | 2f0030d23f85af5ed39e4bab91ff94f1 |
|
BLAKE2b-256 | 4a02e10b6e0c2b13f90f7b59b266d36de93ca388d4c0085e7869e76b5d24074b |