Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for NewLRUExpireCacheWithClock (0.35 sec)

  1. staging/src/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go

    // NewLRUExpireCache creates an expiring cache with the given size
    func NewLRUExpireCache(maxSize int) *LRUExpireCache {
    	return NewLRUExpireCacheWithClock(maxSize, realClock{})
    }
    
    // NewLRUExpireCacheWithClock creates an expiring cache with the given size, using the specified clock to obtain the current time.
    func NewLRUExpireCacheWithClock(maxSize int, clock Clock) *LRUExpireCache {
    	if maxSize <= 0 {
    		panic("maxSize must be > 0")
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 03 18:40:48 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/util/cache/lruexpirecache_test.go

    	expectNotEntry(t, c, "long-lived")
    	expectEntry(t, c, "other-long-lived", "12345")
    }
    
    func TestExpiredGet(t *testing.T) {
    	fakeClock := testingclock.NewFakeClock(time.Now())
    	c := NewLRUExpireCacheWithClock(10, fakeClock)
    	c.Add("short-lived", "12345", 1*time.Millisecond)
    	// ensure the entry expired
    	fakeClock.Step(2 * time.Millisecond)
    
    	// Keys() should not return expired keys.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 03 18:40:48 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go

    	return newLifecycleWithClock(immortalNamespaces, clock.RealClock{})
    }
    
    func newLifecycleWithClock(immortalNamespaces sets.String, clock utilcache.Clock) (*Lifecycle, error) {
    	forceLiveLookupCache := utilcache.NewLRUExpireCacheWithClock(100, clock)
    	return &Lifecycle{
    		Handler:              admission.NewHandler(admission.Create, admission.Update, admission.Delete),
    		immortalNamespaces:   immortalNamespaces,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 15 09:52:18 UTC 2021
    - 8.6K bytes
    - Viewed (0)
Back to top