MCPcopy
hub / github.com/go-gorm/gorm / Values

Method Values

internal/lru/lru.go:253–265  ·  view source on GitHub ↗

Values returns a slice of the values in the cache, from oldest to newest. Expired entries are filtered out.

()

Source from the content-addressed store, hash-verified

251// Values returns a slice of the values in the cache, from oldest to newest.
252// Expired entries are filtered out.
253func (c *LRU[K, V]) Values() []V {
254 c.mu.RLock()
255 defer c.mu.RUnlock()
256 values := make([]V, 0, len(c.items))
257 now := time.Now()
258 for ent := c.evictList.Back(); ent != nil; ent = ent.PrevEntry() {
259 if now.After(ent.ExpiresAt) {
260 continue
261 }
262 values = append(values, ent.Value)
263 }
264 return values
265}
266
267// Len returns the number of items in the cache.
268func (c *LRU[K, V]) Len() int {

Callers 1

TestLRU_ValuesFunction · 0.80

Calls 3

BackMethod · 0.80
PrevEntryMethod · 0.80
AfterMethod · 0.45

Tested by 1

TestLRU_ValuesFunction · 0.64