diff options
author | Erik Johnston <erik@matrix.org> | 2015-08-05 15:47:25 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-08-05 15:47:25 +0100 |
commit | 1229f2213e3139a274be190956da39f706af8038 (patch) | |
tree | 0631ce86ad3e4c1ceec7768d9947479091609ce9 /synapse | |
parent | Merge branch 'develop' of github.com:matrix-org/synapse into erikj/acl_perf (diff) | |
parent | Up the cache size for 'get_joined_hosts_for_room' and 'get_users_in_room' (diff) | |
download | synapse-1229f2213e3139a274be190956da39f706af8038.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/acl_perf
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/storage/_base.py | 6 | ||||
-rw-r--r-- | synapse/storage/roommember.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index 7b76ee3b73..5281f7788d 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -57,7 +57,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 @@ -147,7 +147,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 @@ -198,7 +198,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, diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index 4db07f6fb4..55dd3f6cfb 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -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", |