- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for stringKeyFunc (0.21 sec)
-
pkg/kubelet/util/cache/object_cache.go
func NewObjectCache(f func() (interface{}, error), ttl time.Duration) *ObjectCache { return &ObjectCache{ updater: f, cache: expirationcache.NewTTLStore(stringKeyFunc, ttl), } } // stringKeyFunc is a string as cache key function func stringKeyFunc(obj interface{}) (string, error) { key := obj.(objectEntry).key return key, nil } // Get gets cached objectEntry by using a unique string as the key.
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Thu Aug 25 04:07:36 UTC 2022 - 2.1K bytes - Viewed (0) -
pkg/kubelet/util/cache/object_cache_test.go
ttlPolicy := &expirationcache.TTLPolicy{TTL: ttl, Clock: clock} deleteChan := make(chan string, 1) return &ObjectCache{ updater: f, cache: expirationcache.NewFakeExpirationStore(stringKeyFunc, deleteChan, ttlPolicy, clock), } } func TestAddAndGet(t *testing.T) { testObj := testObject{ key: "foo", val: "bar", } objectCache := NewFakeObjectCache(func() (interface{}, error) {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Sep 17 13:19:08 UTC 2021 - 2.6K bytes - Viewed (0)