aboutsummaryrefslogtreecommitdiff
path: root/internal/caching/impl_inmemorylru.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-12-16 12:15:12 +0000
committerGitHub <noreply@github.com>2020-12-16 12:15:12 +0000
commitb891c00b09ed94d0fdfeb449df5e345c67208700 (patch)
treed6be6dbd5f422f3188401121c967fa3472e9097f /internal/caching/impl_inmemorylru.go
parent90571430330afa887912f55fa6a3b329299d927e (diff)
Add RoomInfo cache, remove RoomServerRoomNIDsCache (#1646)
* Add RoomInfo cache, remove RoomServerRoomNID cache, ensure caches are thread-safe * Don't panic if the roomInfo isn't known yet * LRU package is already threadsafe * Use RoomInfo cache to find room version if possible in Events() * Adding comments about RoomInfoCache safety
Diffstat (limited to 'internal/caching/impl_inmemorylru.go')
-rw-r--r--internal/caching/impl_inmemorylru.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/caching/impl_inmemorylru.go b/internal/caching/impl_inmemorylru.go
index f05e8f3c..cf05a8b5 100644
--- a/internal/caching/impl_inmemorylru.go
+++ b/internal/caching/impl_inmemorylru.go
@@ -45,19 +45,19 @@ func NewInMemoryLRUCache(enablePrometheus bool) (*Caches, error) {
if err != nil {
return nil, err
}
- roomServerRoomNIDs, err := NewInMemoryLRUCachePartition(
- RoomServerRoomNIDsCacheName,
- RoomServerRoomNIDsCacheMutable,
- RoomServerRoomNIDsCacheMaxEntries,
+ roomServerRoomIDs, err := NewInMemoryLRUCachePartition(
+ RoomServerRoomIDsCacheName,
+ RoomServerRoomIDsCacheMutable,
+ RoomServerRoomIDsCacheMaxEntries,
enablePrometheus,
)
if err != nil {
return nil, err
}
- roomServerRoomIDs, err := NewInMemoryLRUCachePartition(
- RoomServerRoomIDsCacheName,
- RoomServerRoomIDsCacheMutable,
- RoomServerRoomIDsCacheMaxEntries,
+ roomInfos, err := NewInMemoryLRUCachePartition(
+ RoomInfoCacheName,
+ RoomInfoCacheMutable,
+ RoomInfoCacheMaxEntries,
enablePrometheus,
)
if err != nil {
@@ -77,8 +77,8 @@ func NewInMemoryLRUCache(enablePrometheus bool) (*Caches, error) {
ServerKeys: serverKeys,
RoomServerStateKeyNIDs: roomServerStateKeyNIDs,
RoomServerEventTypeNIDs: roomServerEventTypeNIDs,
- RoomServerRoomNIDs: roomServerRoomNIDs,
RoomServerRoomIDs: roomServerRoomIDs,
+ RoomInfos: roomInfos,
FederationEvents: federationEvents,
}, nil
}