MCPcopy
hub / github.com/kubernetes/client-go / List

Method List

tools/cache/expiration_cache.go:127–140  ·  view source on GitHub ↗

List retrieves a list of unexpired items. It purges the cache of expired items in the process.

()

Source from the content-addressed store, hash-verified

125// List retrieves a list of unexpired items. It purges the cache of expired
126// items in the process.
127func (c *ExpirationCache) List() []interface{} {
128 items := c.cacheStorage.List()
129
130 list := make([]interface{}, 0, len(items))
131 for _, item := range items {
132 obj := item.(*TimestampedEntry).Obj
133 if key, err := c.keyFunc(obj); err != nil {
134 list = append(list, obj)
135 } else if obj, exists := c.getOrExpire(key); exists {
136 list = append(list, obj)
137 }
138 }
139 return list
140}
141
142// ListKeys returns a list of all keys in the expiration cache.
143func (c *ExpirationCache) ListKeys() []string {

Callers

nothing calls this directly

Calls 2

getOrExpireMethod · 0.95
ListMethod · 0.65

Tested by

no test coverage detected