MCPcopy
hub / github.com/lxzan/gws / SessionStorage

Interface SessionStorage

session_storage.go:8–29  ·  view source on GitHub ↗

SessionStorage 会话存储

Source from the content-addressed store, hash-verified

6
7// SessionStorage 会话存储
8type SessionStorage interface {
9 // Len 返回存储中的键值对数量
10 // Returns the number of key-value pairs in the storage
11 Len() int
12
13 // Load 根据键获取值,如果键存在则返回值和 true,否则返回 nil 和 false
14 // retrieves the value for a given key. If the key exists, it returns the value and true; otherwise, it returns nil and false
15 Load(key string) (value any, exist bool)
16
17 // Delete 根据键删除存储中的键值对
18 // removes the key-value pair from the storage for a given key
19 Delete(key string)
20
21 // Store 存储键值对
22 // saves the key-value pair in the storage
23 Store(key string, value any)
24
25 // Range 遍历
26 // 如果函数返回 false,遍历将提前终止.
27 // If the function returns false, the iteration stops early.
28 Range(f func(key string, value any) bool)
29}
30
31// newSmap 创建并返回一个新的 smap 实例
32// creates and returns a new smap instance

Callers 30

TestMapFunction · 0.65
TestSliceMapFunction · 0.65
TestConcurrentMapFunction · 0.65
ReadLoopMethod · 0.65
TestNewBroadcasterFunction · 0.65
LoadMethod · 0.65
getSessionFunction · 0.65
TestMapFunction · 0.65
TestSliceMapFunction · 0.65
TestConcurrentMapFunction · 0.65
DeleteMethod · 0.65

Implementers 1

smapsession_storage.go

Calls

no outgoing calls

Tested by

no test coverage detected