Fix that some more

This commit is contained in:
Neil Alexander 2022-06-14 14:10:48 +01:00
parent e614269bc3
commit 800dbbf9e4
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 5 additions and 5 deletions

View file

@ -25,9 +25,9 @@ type RoomServerNIDsCache interface {
}
func (c Caches) GetRoomServerRoomID(roomNID types.RoomNID) (string, bool) {
return c.RoomServerRoomIDs.Get(roomNID)
return c.RoomServerRoomIDs.Get(int64(roomNID))
}
func (c Caches) StoreRoomServerRoomID(roomNID types.RoomNID, roomID string) {
c.RoomServerRoomIDs.Set(roomNID, roomID)
c.RoomServerRoomIDs.Set(int64(roomNID), roomID)
}

View file

@ -14,7 +14,7 @@ type Caches struct {
RoomVersions Cache[string, gomatrixserverlib.RoomVersion]
ServerKeys Cache[string, gomatrixserverlib.PublicKeyLookupResult]
RoomServerRoomNIDs Cache[string, types.RoomNID]
RoomServerRoomIDs Cache[types.RoomNID, string]
RoomServerRoomIDs Cache[int64, string]
RoomInfos Cache[string, types.RoomInfo]
FederationPDUs Cache[int64, *gomatrixserverlib.HeaderedEvent]
FederationEDUs Cache[int64, *gomatrixserverlib.EDU]
@ -31,7 +31,7 @@ type Cache[K keyable, T any] interface {
type keyable interface {
// from https://github.com/dgraph-io/ristretto/blob/8e850b710d6df0383c375ec6a7beae4ce48fc8d5/z/z.go#L34
~uint64 | ~string | ~[]byte | ~byte | ~int | ~int32 | ~uint32 | ~int64
uint64 | string | []byte | byte | int | int32 | uint32 | int64
}
type costable interface {

View file

@ -38,7 +38,7 @@ func NewRistrettoCache(maxCost CacheSize, enablePrometheus bool) (*Caches, error
Name: "server_keys",
Mutable: true,
},
RoomServerRoomIDs: &RistrettoCachePartition[types.RoomNID, string]{
RoomServerRoomIDs: &RistrettoCachePartition[int64, string]{
cache: cache,
Name: "room_ids",
},