mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Roomserver NID caches (#1335)
* Initial work on roomserver NID caches * Give caches to roomserver storage * Populate caches * Fix bugs * Fix WASM build * Don't hit cache twice in RoomNIDExcludingStubs * Store reverse room ID-room NID mapping, consult caches when assigning NIDs
This commit is contained in:
parent
05242096a1
commit
c8b873abc8
10 changed files with 239 additions and 18 deletions
|
@ -27,9 +27,49 @@ func NewInMemoryLRUCache(enablePrometheus bool) (*Caches, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
roomServerStateKeyNIDs, err := NewInMemoryLRUCachePartition(
|
||||
RoomServerStateKeyNIDsCacheName,
|
||||
RoomServerStateKeyNIDsCacheMutable,
|
||||
RoomServerStateKeyNIDsCacheMaxEntries,
|
||||
enablePrometheus,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
roomServerEventTypeNIDs, err := NewInMemoryLRUCachePartition(
|
||||
RoomServerEventTypeNIDsCacheName,
|
||||
RoomServerEventTypeNIDsCacheMutable,
|
||||
RoomServerEventTypeNIDsCacheMaxEntries,
|
||||
enablePrometheus,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
roomServerRoomNIDs, err := NewInMemoryLRUCachePartition(
|
||||
RoomServerRoomNIDsCacheName,
|
||||
RoomServerRoomNIDsCacheMutable,
|
||||
RoomServerRoomNIDsCacheMaxEntries,
|
||||
enablePrometheus,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
roomServerRoomIDs, err := NewInMemoryLRUCachePartition(
|
||||
RoomServerRoomIDsCacheName,
|
||||
RoomServerRoomIDsCacheMutable,
|
||||
RoomServerRoomIDsCacheMaxEntries,
|
||||
enablePrometheus,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Caches{
|
||||
RoomVersions: roomVersions,
|
||||
ServerKeys: serverKeys,
|
||||
RoomVersions: roomVersions,
|
||||
ServerKeys: serverKeys,
|
||||
RoomServerStateKeyNIDs: roomServerStateKeyNIDs,
|
||||
RoomServerEventTypeNIDs: roomServerEventTypeNIDs,
|
||||
RoomServerRoomNIDs: roomServerRoomNIDs,
|
||||
RoomServerRoomIDs: roomServerRoomIDs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue