Python Method Cache
What it does
MethodCache can be used to cache the result of an method in a flexible way. This libary has no dependencies!
Currently only TTL Cache available
The cache storage can be segmented in categories.
Methods with the @cache decorator are saved in these categories.
Example
from methodcache import cache, Store
import time
# TTL in Seconds (Default TTl is 60)
st = Store(ttl=60*300)
# Define Store for this Cache, and overwrite Store TTL. And categorize this cache object to demo
@cache(store=st, ttl=5, category="demo")
def doothings(a,b,c):
# Do here what ever you want.
# eg. MySQL querys or other slow operations
time.sleep(2)
return a+b+c
# Slow Execution
doothings(1,2,3)
# Slow Execution
doothings(4,5,6)
# Fast Execution because the Cache was used
doothings(1,2,3)
time.sleep(2)
# Slow Execution because the Cache TTL is Expired
doothings(1,2,3)
Documentation
or
show example.py
Metadata
Release files for method-cache 1.0.4
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 | Actions |
|---|---|---|---|---|
| method_cache-1.0.4.tar.gz | 5.3 kB | Without provenance | Details for method_cache-1.0.4.tar.gz |
Release files / method_cache-1.0.4.tar.gz
| Download URL | method_cache-1.0.4.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
993f26d552af44a4f8b3b34f52320f4b7102a3ac76bda2e1a924022eb7e3470a
|
|
BLAKE2b-256 checksum How to use checksums |
d5b76afcec7f501b02dbed7f5221e6b4aeddca3011ccf93ae76b314f14c6dc86
|
| 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.3
|
Security for method-cache 1.0.4
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.