Release v5.0.0
Notable changes are listed:
Added
- A new method named
random_keyadded toRRCache. - A new method named
expireadded toTTLCache. - Some new methods added to
VTTLCache:expire,items_with_expire. TTLCachenow supportstimedeltaas ttl.VTTLCachenow supportstimedeltaanddatetimeas ttl.- A new method
copyadded to all caches.
Changed
- Now the errors which occurred while doing
__eq__operations will not be ignored:
class A:
def __hash__(self):
return 1
def __eq__(self, other):
raise NotImplementedError("not implemeneted")
cache = cachebox.FIFOCache(0, {A(): 10})
cache[A()]
# Traceback (most recent call last):
# File "script.py", line 11, in <module>
# cache[A()]
# ~~~~~^^^^^
# File "script.py", line 7, in __eq__
# raise NotImplementedError("not implemeneted")
# NotImplementedError: not implemeneted__repr__methods refactored:
cachebox.LRUCache(100, {i:i for i in range(100)})
# cachebox._cachebox.LRUCache[100/100]({0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 34, 35: 35, 36: 36, 37: 37, 38: 38, 39: 39, 40: 40, 41: 41, 42: 42, 43: 43, 44: 44, 45: 45, 46: 46, 47: 47, 48: 48, 49: 49, 50: 50, ... 49 more ...})- The
CacheInfo.cachememoryrenamed toCacheInfo.memory.
Removed
- The
nparameter of theLRUCache.least_recently_usedmethod has been removed.
For more info, see changelog