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

Function NewLRUClientSessionCache

common.go:1652–1663  ·  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

1650// capacity that uses an LRU strategy. If capacity is < 1, a default capacity
1651// is used instead.
1652func NewLRUClientSessionCache(capacity int) ClientSessionCache {
1653 const defaultSessionCacheCapacity = 64
1654
1655 if capacity < 1 {
1656 capacity = defaultSessionCacheCapacity
1657 }
1658 return &lruSessionCache{
1659 m: make(map[string]*list.Element),
1660 q: list.New(),
1661 capacity: capacity,
1662 }
1663}
1664
1665// Put adds the provided (sessionKey, cs) pair to the cache. If cs is nil, the entry
1666// 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…