- Add cache statistics. Thanks uncle-lv!
- Add
Cache.get_ttl. Thanks uncle-lv! - Add
Cache.on_deletecallback hook. Thanks uncle-lv! - Add support for Python 3.11 and 3.12.
- Set minimum Python version to 3.7 in setup.cfg.
- Add support for Python 3.10.
- Drop support for Python 3.6. Minimum supported version is 3.7.
- Clarify docs around TTL to make it explicit what time units it uses by default.
- Minor optimization in
Cache.get_many|delete_many.
- Add
cache_keyattribute to memoized functions that can be used to generate the cache key used for a given set of function arguments. Thanks johnbergvall! - Fix bug in
Cache.fullthat would result in an exception if cache created withmaxsize=NonelikeCache(maxsize=None). Thanks AllinolCP! - Fix bug in
Cache.get_manythat resulted inRuntimeError: OrderedDict mutated during iterationwhen cache keys expire during theget_manycall. - Remove
defaultargument fromCache.get_many. A default value on missing cache key was only ever returned if a list of keys was passed in and those keys happened to expire during theget_manycall. breaking change
- Fix regression in
0.12.0that resulted in missing docstrings for some methods ofLFUCacheandLRUCache.
- Fix bug in
Cache.__contains__where it would returnTruefor an expired key. - Add type annotations.
- Add official support for Python 3.8 and 3.9.
- Drop support for Python 3.4 and 3.5.
- Fix bug in
LFUCachethat would result cache growing beyondmaxsizelimit.
- Fix issue with asyncio support in memoization decorators that caused a
RuntimeError: await wasn't used with futurewhen certain types of async functions were used inside the memoized function.
- Add asyncio support to memoization decorators so they can decorate coroutines.
- Expose
typedargument of underlying*Cache.memoize()inmemoize()and*_memoize()decorators.
- Fix bug in
LRUCache.get()where supplying adefaultvalue would result in aKeyError.
- Support Python 3.7.
- Modify behavior of
defaultargument toCache.get()so that ifdefaultis a callable and the cache key is missing, then it will be called and its return value will be used as the value for cache key and subsequently be set as the value for the key in the cache. (breaking change) - Add
defaultargument toCache()that can be used to override the value fordefaultinCache.get().
- Merge functionality of
Cache.get_many_by()intoCache.get_many()and removeCache.get_many_by(). (breaking change). - Merge functionality of
Cache.delete_many_by()intoCache.delete_many()and removeCache.delete_many_by(). (breaking change).
- Add
Cache.get_many_by(). - Add
Cache.delete_many_by(). - Make
Cache.keys()andCache.values()return dictionary view objects instead of yielding items. (breaking change)
- Changed default cache
maxsizefrom300to256. (breaking change) - Add
Cache.memoize()decorator. - Add standalone memoization decorators:
memoizefifo_memoizelfu_memoizelifo_memoizelru_memoizemru_memoizerr_memoize
- Add
LIFOCache - Add
FIFOCacheas an alias ofCache.
- Add
LFUCache - Delete expired items before popping an item in
Cache.popitem().
- Add
MRUCache - Add
RRCache - Add
Cache.popitem(). - Rename
Cache.expirations()toCache.expire_times(). (breaking change) - Rename
Cache.count()toCache.size(). (breaking change) - Remove
minimumarguement fromCache.evict(). (breaking change)
- Add
LRUCache. - Add
CacheManager.__repr__(). - Make threading lock usage in
Cachemore fine-grained and eliminate redundant locking. - Fix missing thread-safety in
Cache.__len__()andCache.__contains__().
- Rename
Cache.setup()toCache.configure(). (breaking change) - Add
CacheManagerclass.
- Add
Cacheclass.