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 hashes)
Built Distribution
Close
Hashes for weaklru-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c1a2d0e7170b0c69bc00805cc43a61eb949b240f70ecb157f41585006908fd9 |
|
MD5 | cfe374dd41ddb7ef5b6e1e7109262ae5 |
|
BLAKE2b-256 | 01c464dbc884946232caa65c456331955f406a4524f00861c645908528574134 |