jitcache
jitcache is a just-in-time key-value cache that is thread/process safe. jitcache also prevents repeated computation when multiple workers request the same value.
jitcache was designed to improve the performance of Plot.ly Dash apps by caching results and reducing CPU load.
Installation
Install via pip:
$ pip install jitcache
Documentation
Full documentation available here https://jitcache.readthedocs.io/
Example Usage
Notice that slow_fn is only called once, despite two requests.
from cache import KVStore
import time
import json
store = KVStore()
def slow_fn(input_1, input_2):
print("Slow Function Called")
time.sleep(1)
return input_1 * input_2
kwarg_dict = {
'input_1': 10,
'input_2': 4
}
# Make a unique identifier for this object
key = json.dumps(kwarg_dict, sort_keys=True)
# Insert a value with corresponding key
value1 = store.get_value(key, slow_fn, kwarg_dict)
value2 = store.get_value(key, slow_fn, kwarg_dict)
print(value1), print(value2)
Output:
Slow Function Called
40
40
Metadata
Release files for jitcache 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jitcache-0.3-py3-none-any.whl | Python 3 | none | any | Details for jitcache-0.3-py3-none-any.whl |
Release files / jitcache-0.3-py3-none-any.whl
| Download URL | jitcache-0.3-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d4f212c91f0987a2bca3b63939c555bd6190b190b77e8c2f1c4eb1a67cb817a
|
|
BLAKE2b-256 checksum How to use checksums |
b4f011374891b4c3a1f90b6e51a8ca6467b14bccf3384351e5f290dcbcd1dd5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.7.2
|
Security for jitcache 0.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.