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.2.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file nr.caching-0.3.2.tar.gz
.
File metadata
- Download URL: nr.caching-0.3.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b82fa0c51bffa7a26c8878cb1b7c3ec176cecaa93914abd0d4353d07101678fe |
|
MD5 | 3239a6044c4dae262d7452da51807854 |
|
BLAKE2b-256 | d2349d0d957a82acb2cda806e9851f8fbc7eb10a41ef17f2b28e46c040516570 |
File details
Details for the file nr.caching-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: nr.caching-0.3.2-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba0cc1daf5e50c365fb881e907013d44e4a94c842bc7c517fc63ea4f19c5a601 |
|
MD5 | 41bd7fc6d74b562f0cb66254206139b5 |
|
BLAKE2b-256 | 26c8b252032c912eea85344dba36a233c85d09e0b30acca73cefca104d38e3d2 |