Python-LRU-cache
Python-LRU-cache copied to clipboard
An in-memory LRU cache for python
``` m = LRUCacheDict(max_size=3, expiration=5) m["1"]=1 m["2"]=2 m["3"]=3 time.sleep(6) if "1" in m: print m["1"] # KeyError ````
`pip install pylru` this command is suited for [this project](https://github.com/jlhutch/pylru), your project can be installed by cloning and `python setup.py install`.
If you try this code from the docs: ``` d = LRUCacheDict(max_size=3, expiration=3, thread_clear=True) @lru_cache_function(cache=d) def f(x): return x/2 ``` You'll get this error: `TypeError: lru_cache_function() got an unexpected keyword...