mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
More flexible caching (#1101)
This commit is contained in:
parent
76ff47c052
commit
e7b19d2c70
16 changed files with 189 additions and 142 deletions
|
@ -16,7 +16,7 @@ type RoomserverInternalAPI struct {
|
|||
DB storage.Database
|
||||
Cfg *config.Dendrite
|
||||
Producer sarama.SyncProducer
|
||||
ImmutableCache caching.ImmutableCache
|
||||
Cache caching.RoomVersionCache
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
KeyRing gomatrixserverlib.JSONVerifier
|
||||
FedClient *gomatrixserverlib.FederationClient
|
||||
|
|
|
@ -951,7 +951,7 @@ func (r *RoomserverInternalAPI) QueryRoomVersionForRoom(
|
|||
request *api.QueryRoomVersionForRoomRequest,
|
||||
response *api.QueryRoomVersionForRoomResponse,
|
||||
) error {
|
||||
if roomVersion, ok := r.ImmutableCache.GetRoomVersion(request.RoomID); ok {
|
||||
if roomVersion, ok := r.Cache.GetRoomVersion(request.RoomID); ok {
|
||||
response.RoomVersion = roomVersion
|
||||
return nil
|
||||
}
|
||||
|
@ -961,6 +961,6 @@ func (r *RoomserverInternalAPI) QueryRoomVersionForRoom(
|
|||
return err
|
||||
}
|
||||
response.RoomVersion = roomVersion
|
||||
r.ImmutableCache.StoreRoomVersion(request.RoomID, response.RoomVersion)
|
||||
r.Cache.StoreRoomVersion(request.RoomID, response.RoomVersion)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue