Cachalot

Cachalot is a minimal persistent memoization cache. It provides a decorator, that stores function result for future use. Perfect for heavy computations and I/O operation (such as web requests). On backend, it uses TinyDB for storage.
Features
- Simple usage via decorator
- Persistent caching
- Key expiration
- Maximum cache size, to prevent bloat
Installation
Cachalot requires Python 3.5 or newer to run.
Python package
You can easily install Cachalot using pip:
pip3 install cachalot
Manual
Alternatively, to get the latest development version, you can clone this repository and then manually install it:
git clone git@gitlab.com:radek-sprta/cachalot.git
cd cachalot
python3 setup.py install
Usage
from cachalot import Cache
@Cache()
def expensive_function():
return expensive_calculation()
Advanced usage
from cachalot import Cache
@Cache(path='cache.json', timeout=3600, size=5e3, filesize=1e6, retry=True)
def expensive_function():
return expensive_calculation()
path: Path to the database file. Defaults to .cache.json.timeout: How long should the data be cached in seconds. Defaults to 0 (infinite).size: Maximum number of keys cached. Defaults to 0 (infinite).filesize: Maximum size of database file in bytes. Defaults to 0 (infinite).retry: Retry if result is blank. Defaults to False.
For more information, see documentation.
Contributing
For information on how to contribute to the project, please check the Contributor's Guide
Contact
incoming+radek-sprta/cachalot@gitlab.com
License
MIT License
Credits
This package was created with Cookiecutter and the python-cookiecutter project template. Inspired by Cashier
Metadata
Release files for Cachalot 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cachalot-1.1.0.tar.gz | 8.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cachalot-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / cachalot-1.1.0.tar.gz
| Download URL | cachalot-1.1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e276bc1961e0c6461ec7ef495f91335cb79493d47320a1a5f66cee6cec5e350e
|
|
BLAKE2b-256 checksum How to use checksums |
9f60dfa13ca46d855f2754b8515e5ae980eb20e22cf4b097d1742dfb947f820c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Release files / cachalot-1.1.0-py3-none-any.whl
| Download URL | cachalot-1.1.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b108fab0691438bad5cca29fadf87e430c78e0228f98fd1c46c4f5ad93919ff8
|
|
BLAKE2b-256 checksum How to use checksums |
bf728debb4c935dff4a884a2ea6fdc4507660608ed4233f7b42657330af1f2c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Security for Cachalot 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.