Documentation ¶
Index ¶
- type 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 TimeoutCallbackFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EDUCache ¶
EDUCache maintains a list of users typing in each room.
func (*EDUCache) AddTypingUser ¶
AddTypingUser sets an user as typing in a room. expire is the time when the user typing should time out. if expire is nil, defaultTypingTimeout is assumed. Returns the latest sync position for typing after update.
func (*EDUCache) GetLatestSyncPosition ¶
func (*EDUCache) GetTypingUsers ¶
GetTypingUsers returns the list of users typing in a room.
func (*EDUCache) GetTypingUsersIfUpdatedAfter ¶
func (t *EDUCache) GetTypingUsersIfUpdatedAfter( roomID string, position int64, ) (users []string, updated bool)
GetTypingUsersIfUpdatedAfter returns all users typing in this room with updated == true if the typing sync position of the room is after the given position. Otherwise, returns an empty slice with updated == false.
func (*EDUCache) RemoveUser ¶
RemoveUser with mutex lock & stop the timer. Returns the latest sync position for typing after update.
func (*EDUCache) SetTimeoutCallback ¶
func (t *EDUCache) SetTimeoutCallback(fn TimeoutCallbackFn)
SetTimeoutCallback sets a callback function that is called right after a user is removed from the typing user list due to timeout.
type TimeoutCallbackFn ¶
TimeoutCallbackFn is a function called right after the removal of a user from the typing user list due to timeout. latestSyncPosition is the typing sync position after the removal.