Show More
@@ -41,7 +41,14 b' class LRUMemoryBackend(memory_backend.Me' | |||||
41 |
|
41 | |||
42 | def __init__(self, arguments): |
|
42 | def __init__(self, arguments): | |
43 | max_size = arguments.pop('max_size', _default_max_size) |
|
43 | max_size = arguments.pop('max_size', _default_max_size) | |
44 | arguments['cache_dict'] = LRUDict(max_size) |
|
44 | callback = None | |
|
45 | if arguments.pop('log_max_size_reached', None): | |||
|
46 | def evicted(key, value): | |||
|
47 | log.debug( | |||
|
48 | 'LRU: evicting key `%s` due to max size %s reach', key, max_size) | |||
|
49 | callback = evicted | |||
|
50 | ||||
|
51 | arguments['cache_dict'] = LRUDict(max_size, callback=callback) | |||
45 | super(LRUMemoryBackend, self).__init__(arguments) |
|
52 | super(LRUMemoryBackend, self).__init__(arguments) | |
46 |
|
53 | |||
47 | def delete(self, key): |
|
54 | def delete(self, key): |
General Comments 0
You need to be logged in to leave comments.
Login now