mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-20 02:54:08 -04:00
Move cache size fiddling to descriptors only. Fix tests
This commit is contained in:
parent
910fc0f28f
commit
ce2cdced61
2 changed files with 9 additions and 7 deletions
|
@ -45,8 +45,6 @@ CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.1))
|
|||
class Cache(object):
|
||||
|
||||
def __init__(self, name, max_entries=1000, keylen=1, lru=True, tree=False):
|
||||
max_entries = int(max_entries * CACHE_SIZE_FACTOR)
|
||||
|
||||
if lru:
|
||||
cache_type = TreeCache if tree else dict
|
||||
self.cache = LruCache(
|
||||
|
@ -146,6 +144,8 @@ class CacheDescriptor(object):
|
|||
"""
|
||||
def __init__(self, orig, max_entries=1000, num_args=1, lru=True, tree=False,
|
||||
inlineCallbacks=False):
|
||||
max_entries = int(max_entries * CACHE_SIZE_FACTOR)
|
||||
|
||||
self.orig = orig
|
||||
|
||||
if inlineCallbacks:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue