forked from MirrorHub/synapse
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/dictionary_cache
This commit is contained in:
commit
b52b4a84ec
2 changed files with 5 additions and 5 deletions
|
@ -58,7 +58,7 @@ cache_counter = metrics.register_cache(
|
|||
|
||||
class Cache(object):
|
||||
|
||||
def __init__(self, name, max_entries=1000, keylen=1, lru=False):
|
||||
def __init__(self, name, max_entries=1000, keylen=1, lru=True):
|
||||
if lru:
|
||||
self.cache = LruCache(max_size=max_entries)
|
||||
self.max_entries = None
|
||||
|
@ -158,7 +158,7 @@ class CacheDescriptor(object):
|
|||
which can be used to insert values into the cache specifically, without
|
||||
calling the calculation function.
|
||||
"""
|
||||
def __init__(self, orig, max_entries=1000, num_args=1, lru=False):
|
||||
def __init__(self, orig, max_entries=1000, num_args=1, lru=True):
|
||||
self.orig = orig
|
||||
|
||||
self.max_entries = max_entries
|
||||
|
@ -209,7 +209,7 @@ class CacheDescriptor(object):
|
|||
return wrapped
|
||||
|
||||
|
||||
def cached(max_entries=1000, num_args=1, lru=False):
|
||||
def cached(max_entries=1000, num_args=1, lru=True):
|
||||
return lambda orig: CacheDescriptor(
|
||||
orig,
|
||||
max_entries=max_entries,
|
||||
|
|
|
@ -78,7 +78,7 @@ class RoomMemberStore(SQLBaseStore):
|
|||
lambda events: events[0] if events else None
|
||||
)
|
||||
|
||||
@cached()
|
||||
@cached(max_entries=5000)
|
||||
def get_users_in_room(self, room_id):
|
||||
def f(txn):
|
||||
|
||||
|
@ -154,7 +154,7 @@ class RoomMemberStore(SQLBaseStore):
|
|||
RoomsForUser(**r) for r in self.cursor_to_dict(txn)
|
||||
]
|
||||
|
||||
@cached()
|
||||
@cached(max_entries=5000)
|
||||
def get_joined_hosts_for_room(self, room_id):
|
||||
return self.runInteraction(
|
||||
"get_joined_hosts_for_room",
|
||||
|
|
Loading…
Reference in a new issue