A simple python implementation for the least recently used caching algorithm.
Hello, world
A simple use for LRU:
from lru_py import LRU lru_cache = LRU(max_size = 2) lru_cache['hello'] = 'world' lru_cache['world'] = 'hello' lru_cache['hello'] = 'world' print "The first item now is: " + lru_cache.top() print "The value of the key 'world' now is: " + lru_cache['world'] print "The first item now after retrieving the key 'world' is: " +lru_cache.top()
How To:
Initializing an object:
lru_cache = LRU(max_size = 2)
Setting a value, regular assigningment with the square bracket operator [ ]:
lru_cache[‘hello’] = ‘world’
Retrieving a value, using square bracket operator [ ]:
lru_cache[‘hello’]
Deletin, using the del and using square bracket operators:
del lru_cache[‘hello’]
Retrieving the most recently used item:
lru_cache.top()
Installation
Automatic installation:
pip install lru_py
Manual installation: Download the latest source from GitHub.
tar xvzf lru_py-[VERSION].tar.gz cd lru_py-[VERSION] python setup.py build sudo python setup.py install
Metadata
Release files for lru_py 0.2
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_py-0.2.tar.gz | 2.4 kB | Without provenance | Details for lru_py-0.2.tar.gz |
Release files / lru_py-0.2.tar.gz
| Download URL | lru_py-0.2.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a002c09c0130b69bec03558939f997f1abe25090f617a8b26f7cb454de500c2
|
|
BLAKE2b-256 checksum How to use checksums |
15327a02a225aef18f2de3e8eae331eabde9eb94b008b77ed2e01e549b700364
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lru_py 0.2
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.