diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-04-22 13:00:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 13:00:05 +0100 |
commit | a466e9e9cc86e04b4d28de45cd44199916664768 (patch) | |
tree | 70e234ac80ade783acdccadb24f27395712b5748 /roomserver/roomserver.go | |
parent | 71f9d35b7c2f1531b383f115ad3ab23e8d1ed0a5 (diff) |
LRU cache for room versions in RS query API (#976)
* Experimental LRU cache for room versions
* Don't accidentally try to type-assert nil
* Also reduce hits on query API
* Use hashicorp implementation which mutexes for us
* Define const for max cache entries
* Rename to be specifically immutable, panic if we try to mutate a cache entry
* Review comments
* Remove nil guards, give roomserver integration test a cache
* go mod tidy
Diffstat (limited to 'roomserver/roomserver.go')
-rw-r--r-- | roomserver/roomserver.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/roomserver/roomserver.go b/roomserver/roomserver.go index 2ffbf67d..fa4f2062 100644 --- a/roomserver/roomserver.go +++ b/roomserver/roomserver.go @@ -48,7 +48,10 @@ func SetupRoomServerComponent( inputAPI.SetupHTTP(http.DefaultServeMux) - queryAPI := query.RoomserverQueryAPI{DB: roomserverDB} + queryAPI := query.RoomserverQueryAPI{ + DB: roomserverDB, + ImmutableCache: base.ImmutableCache, + } queryAPI.SetupHTTP(http.DefaultServeMux) |