=========
This is a Least Recently Used (LRU) Cache implementation in Python.
INSTALLATION
To install, simply run
python setup.py install
To run unit tests, run
python setup.py test
EXAMPLE USAGE
>>> from time import sleep
>>>
>>> from lru_cacher import LruCacher
>>>
>>> def slowSqrt(n):
>>> sleep(2)
>>> return n**0.5
>>>
>>> cache = LruCache(max_size=200, plan_b_func=slowSqrt)
>>> #This lookup will be slow
>>> answer, found_in_cache = cache.lookup(49)
>>> print answer, found_in_cache
7.0 False
>>>
>>> #This lookup will be fast
>>> answer, found_in_cache = cache.lookup(49)
>>> print answer, found_in_cache
7.0 True
>>>
>>> #Let's modify the cache
>>> cache.update(49, 'seven')
>>> answer, found_in_cache = cache.lookup(49)
>>> print answer, found_in_cache
seven True
Metadata
Release files for lru_cacher 1.0.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 | Actions |
|---|---|---|---|---|
| lru_cacher-1.0.0.tar.gz | 2.5 kB | Without provenance | Details for lru_cacher-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lru_cacher-1.0.0.macosx-10.5-x86_64.exe | Details for lru_cacher-1.0.0.macosx-10.5-x86_64.exe |
Total release size: 69.5 kB
Release files / lru_cacher-1.0.0.tar.gz
| Download URL | lru_cacher-1.0.0.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffbd9ef559e79838472824db5226ef3fd68eb79eb5d506a349cbaaab189a74f2
|
|
BLAKE2b-256 checksum How to use checksums |
70333ef83a8d5343635864f82b3a9d36618681925686189b85e2f2a27a7d5cfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lru_cacher-1.0.0.macosx-10.5-x86_64.exe
| Download URL | lru_cacher-1.0.0.macosx-10.5-x86_64.exe |
|---|---|
| Size | 67.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7a6fd2cb8b6227574b72f0d28e395c66864a3a24a69dec2d47731f321a43403
|
|
BLAKE2b-256 checksum How to use checksums |
1bf83afca71abc11892bc9972c6714c153bf1b4a4bafbc352e072c7d6a1a24c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lru_cacher 1.0.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.