mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 15:44:50 -04:00
Reset size on clear
This commit is contained in:
parent
49c328a892
commit
50e18938a9
1 changed files with 2 additions and 0 deletions
|
@ -37,6 +37,7 @@ class LruCache(object):
|
||||||
"""
|
"""
|
||||||
def __init__(self, max_size, keylen=1, cache_type=dict):
|
def __init__(self, max_size, keylen=1, cache_type=dict):
|
||||||
cache = cache_type()
|
cache = cache_type()
|
||||||
|
self.cache = cache # Used for introspection.
|
||||||
self.size = 0
|
self.size = 0
|
||||||
list_root = []
|
list_root = []
|
||||||
list_root[:] = [list_root, list_root, None, None]
|
list_root[:] = [list_root, list_root, None, None]
|
||||||
|
@ -142,6 +143,7 @@ class LruCache(object):
|
||||||
list_root[NEXT] = list_root
|
list_root[NEXT] = list_root
|
||||||
list_root[PREV] = list_root
|
list_root[PREV] = list_root
|
||||||
cache.clear()
|
cache.clear()
|
||||||
|
self.size = 0
|
||||||
|
|
||||||
@synchronized
|
@synchronized
|
||||||
def cache_len():
|
def cache_len():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue