Skip to content

Commit 0cb17b0

Browse files
Exported DecayingLRUCache from lru.py
1 parent 61ca083 commit 0cb17b0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

darts/lib/utils/lru.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
__all__ = (
3131
'LRUDict', 'AutoLRUCache', 'CacheLoadError', 'CacheAbandonedError',
32-
'CachingError', 'SynchronizedLRUDict',
32+
'CachingError', 'SynchronizedLRUDict', 'DecayingLRUCache',
3333
)
3434

3535
def log():
@@ -987,6 +987,13 @@ class DecayingLRUCache(object):
987987
988988
Note, that eviction is *not* in any way controlled by
989989
the `tester` function, but by access order only!
990+
991+
Note, that unlike `AutoLRUCache`, this class does not
992+
consider a `None` result from the `loader` function to be
993+
special in any way. It is up to the `tester` function to
994+
decide, whether the entry is "good" (i.e., should be
995+
reported back to the application) or not (i.e., must be
996+
reloaded upon access).
990997
"""
991998

992999
__slots__ = (
@@ -1002,7 +1009,6 @@ class DecayingLRUCache(object):
10021009
def __init__(self, loader, tester=good, key=identity, capacity=1024):
10031010

10041011
"""Initialize a new instance
1005-
10061012
"""
10071013

10081014
super(CarefulLRUCache, self).__init__()

0 commit comments

Comments
 (0)