Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for testCacheEvictExpired (0.16 sec)

  1. pkg/cache/ttlCache_test.go

    }
    
    func TestTTLEvicter(t *testing.T) {
    	ttl := NewTTL(5*time.Second, 1*time.Millisecond)
    	testCacheEvicter(ttl)
    }
    
    func TestTTLEvictExpired(t *testing.T) {
    	ttl := NewTTL(5*time.Second, 0).(*ttlCache)
    	testCacheEvictExpired(ttl, t)
    }
    
    type callbackRecorder struct {
    	callbacks int64
    }
    
    func (c *callbackRecorder) callback(key, value any) {
    	atomic.AddInt64(&c.callbacks, 1)
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  2. pkg/cache/cache_test.go

    	_, ok = c.Get("LATER")
    	if ok {
    		t.Errorf("Got value, expected LATER to have been evicted")
    	}
    
    	if s.Evictions != 2 {
    		t.Errorf("Got %d evictions, expecting 2", s.Evictions)
    	}
    }
    
    func testCacheEvictExpired(c ExpiringCache, t *testing.T) {
    	c.SetWithExpiration("A", "A", 1*time.Millisecond)
    
    	_, ok := c.Get("A")
    	if !ok {
    		t.Error("Got no entry, expecting it to be there")
    	}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 15:56:49 UTC 2023
    - 8.5K bytes
    - Viewed (0)
Back to top