Versions in this module Expand all Collapse all v0 v0.14.1 Jan 16, 2025 v0.14.0 Dec 18, 2024 Changes in this version + const DisableMetrics + const EnableMetrics + type Cache interface + Get func(key K) (value T, ok bool) + Set func(key K, value T) + Unset func(key K) + type Caches struct + FederationEDUs Cache[int64, *gomatrixserverlib.EDU] + FederationPDUs Cache[int64, *types.HeaderedEvent] + LazyLoading Cache[lazyLoadingCacheKey, string] + RoomHierarchies Cache[string, fclient.RoomHierarchyResponse] + RoomServerEventTypeNIDs Cache[string, types.EventTypeNID] + RoomServerEventTypes Cache[types.EventTypeNID, string] + RoomServerEvents Cache[int64, *types.HeaderedEvent] + RoomServerRoomIDs Cache[types.RoomNID, string] + RoomServerRoomNIDs Cache[string, types.RoomNID] + RoomServerStateKeyNIDs Cache[string, types.EventStateKeyNID] + RoomServerStateKeys Cache[types.EventStateKeyNID, string] + RoomVersions Cache[string, gomatrixserverlib.RoomVersion] + ServerKeys Cache[string, gomatrixserverlib.PublicKeyLookupResult] + func NewRistrettoCache(maxCost config.DataUnit, maxAge time.Duration, enablePrometheus bool) *Caches + func (c Caches) EvictFederationQueuedEDU(eventNID int64) + func (c Caches) EvictFederationQueuedPDU(eventNID int64) + func (c Caches) GetEventStateKey(eventStateKeyNID types.EventStateKeyNID) (string, bool) + func (c Caches) GetEventStateKeyNID(eventStateKey string) (types.EventStateKeyNID, bool) + func (c Caches) GetEventTypeKey(eventType string) (types.EventTypeNID, bool) + func (c Caches) GetFederationQueuedEDU(eventNID int64) (*gomatrixserverlib.EDU, bool) + func (c Caches) GetFederationQueuedPDU(eventNID int64) (*types.HeaderedEvent, bool) + func (c Caches) GetRoomHierarchy(roomID string) (r fclient.RoomHierarchyResponse, ok bool) + func (c Caches) GetRoomServerEvent(eventNID types.EventNID) (*types.HeaderedEvent, bool) + func (c Caches) GetRoomServerRoomID(roomNID types.RoomNID) (string, bool) + func (c Caches) GetRoomServerRoomNID(roomID string) (types.RoomNID, bool) + func (c Caches) GetRoomVersion(roomID string) (gomatrixserverlib.RoomVersion, bool) + func (c Caches) GetServerKey(request gomatrixserverlib.PublicKeyLookupRequest, timestamp spec.Timestamp) (gomatrixserverlib.PublicKeyLookupResult, bool) + func (c Caches) InvalidateLazyLoadedUser(device *userapi.Device, roomID, userID string) + func (c Caches) InvalidateRoomServerEvent(eventNID types.EventNID) + func (c Caches) IsLazyLoadedUserCached(device *userapi.Device, roomID, userID string) (string, bool) + func (c Caches) StoreEventStateKey(eventStateKeyNID types.EventStateKeyNID, eventStateKey string) + func (c Caches) StoreEventTypeKey(eventTypeNID types.EventTypeNID, eventType string) + func (c Caches) StoreFederationQueuedEDU(eventNID int64, event *gomatrixserverlib.EDU) + func (c Caches) StoreFederationQueuedPDU(eventNID int64, event *types.HeaderedEvent) + func (c Caches) StoreLazyLoadedUser(device *userapi.Device, roomID, userID, eventID string) + func (c Caches) StoreRoomHierarchy(roomID string, r fclient.RoomHierarchyResponse) + func (c Caches) StoreRoomServerEvent(eventNID types.EventNID, event *types.HeaderedEvent) + func (c Caches) StoreRoomServerRoomID(roomNID types.RoomNID, roomID string) + func (c Caches) StoreRoomVersion(roomID string, roomVersion gomatrixserverlib.RoomVersion) + func (c Caches) StoreServerKey(request gomatrixserverlib.PublicKeyLookupRequest, ...) + type EDUCache struct + func NewTypingCache() *EDUCache + func (t *EDUCache) AddTypingUser(userID, roomID string, expire *time.Time) int64 + func (t *EDUCache) GetLatestSyncPosition() int64 + func (t *EDUCache) GetTypingUsers(roomID string) []string + func (t *EDUCache) GetTypingUsersIfUpdatedAfter(roomID string, position int64) (users []string, updated bool) + func (t *EDUCache) RemoveUser(userID, roomID string) int64 + func (t *EDUCache) SetTimeoutCallback(fn TimeoutCallbackFn) + type EventStateKeyCache interface + GetEventStateKey func(eventStateKeyNID types.EventStateKeyNID) (string, bool) + GetEventStateKeyNID func(eventStateKey string) (types.EventStateKeyNID, bool) + StoreEventStateKey func(eventStateKeyNID types.EventStateKeyNID, eventStateKey string) + type EventTypeCache interface + GetEventTypeKey func(eventType string) (types.EventTypeNID, bool) + StoreEventTypeKey func(eventTypeNID types.EventTypeNID, eventType string) + type FederationCache interface + EvictFederationQueuedEDU func(eventNID int64) + EvictFederationQueuedPDU func(eventNID int64) + GetFederationQueuedEDU func(eventNID int64) (event *gomatrixserverlib.EDU, ok bool) + GetFederationQueuedPDU func(eventNID int64) (event *types.HeaderedEvent, ok bool) + StoreFederationQueuedEDU func(eventNID int64, event *gomatrixserverlib.EDU) + StoreFederationQueuedPDU func(eventNID int64, event *types.HeaderedEvent) + type LazyLoadCache interface + InvalidateLazyLoadedUser func(device *userapi.Device, roomID, userID string) + IsLazyLoadedUserCached func(device *userapi.Device, roomID, userID string) (string, bool) + StoreLazyLoadedUser func(device *userapi.Device, roomID, userID, eventID string) + type RistrettoCachePartition struct + MaxAge time.Duration + Mutable bool + Prefix byte + func (c *RistrettoCachePartition[K, V]) Get(key K) (value V, ok bool) + func (c *RistrettoCachePartition[K, V]) Set(key K, value V) + func (c *RistrettoCachePartition[K, V]) Unset(key K) + type RistrettoCostedCachePartition struct + func (c *RistrettoCostedCachePartition[K, V]) Set(key K, value V) + type RoomHierarchyCache interface + GetRoomHierarchy func(roomID string) (r fclient.RoomHierarchyResponse, ok bool) + StoreRoomHierarchy func(roomID string, r fclient.RoomHierarchyResponse) + type RoomServerCaches interface + type RoomServerEventsCache interface + GetRoomServerEvent func(eventNID types.EventNID) (*types.HeaderedEvent, bool) + InvalidateRoomServerEvent func(eventNID types.EventNID) + StoreRoomServerEvent func(eventNID types.EventNID, event *types.HeaderedEvent) + type RoomServerNIDsCache interface + GetRoomServerRoomID func(roomNID types.RoomNID) (string, bool) + GetRoomServerRoomNID func(roomID string) (types.RoomNID, bool) + StoreRoomServerRoomID func(roomNID types.RoomNID, roomID string) + type RoomVersionCache interface + GetRoomVersion func(roomID string) (roomVersion gomatrixserverlib.RoomVersion, ok bool) + StoreRoomVersion func(roomID string, roomVersion gomatrixserverlib.RoomVersion) + type ServerKeyCache interface + GetServerKey func(request gomatrixserverlib.PublicKeyLookupRequest, timestamp spec.Timestamp) (response gomatrixserverlib.PublicKeyLookupResult, ok bool) + StoreServerKey func(request gomatrixserverlib.PublicKeyLookupRequest, ...) + type TimeoutCallbackFn func(userID, roomID string, latestSyncPosition int64)