Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cacher ¶
type Cacher struct {
// contains filtered or unexported fields
}
Cacher caches GC messages fetched immediately after going online to improve UX of notifications of new messages.
func New ¶
func New(maxLifetime, updateDelay, initialDelay time.Duration, log slog.Logger, handler func(Msg)) *Cacher
New creates a new GC message cacher. delayTimeout is the time between messages which causes the cacher to delay delivering messages. maxDelayTimeout is a max delay after which messages will be delivered, regardless of being received within delayDuration of each other.
func (*Cacher) GCMessageReceived ¶
func (c *Cacher) GCMessageReceived(uid clientintf.UserID, gcm rpc.RMGroupMessage, ts time.Time)
GCMessageReceived should be called whenever a new GC message is externally received.
func (*Cacher) RMReceived ¶ added in v0.1.4
func (c *Cacher) RMReceived(uid clientintf.UserID, ts time.Time)
RMReceived should be called whenever an RM for a user is received.
func (*Cacher) SessionChanged ¶
SessionChanged should be called whenever the session changes.
type Msg ¶
type Msg struct { UID clientintf.UserID GCM rpc.RMGroupMessage TS time.Time }
Msg is an individual message stored by the GC Message cacher.