Combination of weakref cache and LRU cache.
Project description
weaklru
Simple combination of a weakref cache and a lru cache.
class Obj:
pass
l = WeakLRU(max_size=2)
l.set("a", Obj())
l.set("b", Obj())
l.set("c", Obj())
l.get(a) # none
l.get(b) # obj
l.get(c) # obj
You can add objects to the cache, and they will never expire as long as they are being used.
Also, a maximum number of objects will be stored in the LRU portion of the cache.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
weaklru-0.1.1.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file weaklru-0.1.1.tar.gz
.
File metadata
- Download URL: weaklru-0.1.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.6.8 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aac7504b2023087d95908502785be4aebc294a132cf28d2b4660cfc066f6b64 |
|
MD5 | b30b5b5273c4110906a5c31a80761979 |
|
BLAKE2b-256 | c31b89dac84b14d425e9fc3d4866f9e2f63a4dade92a9dc2a9f7e9417a570f4b |
File details
Details for the file weaklru-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: weaklru-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.6.8 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c1a2d0e7170b0c69bc00805cc43a61eb949b240f70ecb157f41585006908fd9 |
|
MD5 | cfe374dd41ddb7ef5b6e1e7109262ae5 |
|
BLAKE2b-256 | 01c464dbc884946232caa65c456331955f406a4524f00861c645908528574134 |