MCPcopy Create free account
hub / github.com/XTLS/Go / NewLRUClientSessionCache

Function NewLRUClientSessionCache

common.go:1400–1411  ·  view source on GitHub ↗

NewLRUClientSessionCache returns a ClientSessionCache with the given capacity that uses an LRU strategy. If capacity is < 1, a default capacity is used instead.

(capacity int)

Source from the content-addressed store, hash-verified

1398// capacity that uses an LRU strategy. If capacity is < 1, a default capacity
1399// is used instead.
1400func NewLRUClientSessionCache(capacity int) ClientSessionCache {
1401 const defaultSessionCacheCapacity = 64
1402
1403 if capacity < 1 {
1404 capacity = defaultSessionCacheCapacity
1405 }
1406 return &lruSessionCache{
1407 m: make(map[string]*list.Element),
1408 q: list.New(),
1409 capacity: capacity,
1410 }
1411}
1412
1413// Put adds the provided (sessionKey, cs) pair to the cache. If cs is nil, the entry
1414// corresponding to sessionKey is removed from the cache instead.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…