Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for evictExpired (0.27 sec)

  1. pkg/cache/ttlCache_test.go

    	ttl := NewTTL(5*time.Second, 1*time.Second)
    	testCacheConcurrent(ttl, t)
    }
    
    func TestTTLExpiration(t *testing.T) {
    	ttl := NewTTL(5*time.Second, 0).(*ttlCache)
    	testCacheExpiration(ttl, ttl.evictExpired, t)
    }
    
    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)
    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

    func testCacheExpiration(c ExpiringCache, evictExpired func(time.Time), t *testing.T) {
    	now := time.Now()
    
    	c.SetWithExpiration("EARLY", "123", 10*time.Millisecond)
    	c.SetWithExpiration("LATER", "123", 20*time.Millisecond+123*time.Nanosecond)
    
    	evictExpired(now)
    	s := c.Stats()
    
    	_, ok := c.Get("EARLY")
    	if !ok {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 15:56:49 UTC 2023
    - 8.5K bytes
    - Viewed (0)
  3. pkg/cache/ttlCache.go

    	ticker := time.NewTicker(evictionInterval)
    	for {
    		select {
    		case now := <-ticker.C:
    			c.evictExpired(now)
    		case <-c.stopEvicter:
    			ticker.Stop()
    			c.evicterTerminated.Done() // record this for the sake of unit tests
    			return
    		}
    	}
    }
    
    func (c *ttlCache) evictExpired(t time.Time) {
    	// We snapshot a base time here such that the time doesn't need to be
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  4. pkg/cache/cache.go

    	// requested expiration time.
    	SetWithExpiration(key any, value any, expiration time.Duration)
    
    	// EvictExpired() synchronously evicts all expired entries from the cache
    	EvictExpired()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 3.9K bytes
    - Viewed (0)
Back to top