cache

package
v1.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInCache

func NewInCache(db chat.Store) chat.Store

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache wraps a chat.Store, caching DM membership checks. A DM's membership is fixed at chat creation and never changes, so a confirmed DM member is safe to cache. Group membership is mutable — and can be mutated by other processes, which this cache can never observe — so group membership checks always defer to the backing store. The rest of the store is passed straight through.

func (*Cache) AddGroupMembers added in v1.26.0

func (c *Cache) AddGroupMembers(ctx context.Context, chatID *commonpb.ChatId, userIDs []*commonpb.UserId) error

func (*Cache) AdvanceLastMessage

func (c *Cache) AdvanceLastMessage(ctx context.Context, chatID *commonpb.ChatId, messageID *messagingpb.MessageId, ts time.Time) (bool, []*commonpb.UserId, error)

func (*Cache) GetChatByID

func (c *Cache) GetChatByID(ctx context.Context, chatID *commonpb.ChatId) (*chat.Chat, error)

func (*Cache) GetDmFeedPage

func (c *Cache) GetDmFeedPage(ctx context.Context, userID *commonpb.UserId, chatType chatpb.ChatType, snapshot time.Time, cursor *chat.DmFeedCursor, limit int) ([]*chat.Chat, error)

func (*Cache) GetMembers

func (c *Cache) GetMembers(ctx context.Context, chatID *commonpb.ChatId) ([]*commonpb.UserId, error)

func (*Cache) IsMember

func (c *Cache) IsMember(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, error)

func (*Cache) PutChat

func (c *Cache) PutChat(ctx context.Context, ch *chat.Chat) error

func (*Cache) RemoveGroupMember added in v1.26.0

func (c *Cache) RemoveGroupMember(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL