Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for SetWithExpiration (0.16 sec)

  1. pkg/ledger/trie_cache.go

    	if ok {
    		value, _ = ivalue.([][]byte)
    	}
    	return
    }
    
    // SetWithExpiration inserts an entry in the cache with a requested expiration time.
    // This will replace any entry with the same key that is already in the cache.
    // The entry will be automatically expunged from the cache at or slightly after the
    // requested expiration time.
    func (b *byteCache) SetWithExpiration(key hash, value [][]byte, expiration time.Duration) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 2K 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/cache.go

    type ExpiringCache interface {
    	Cache
    
    	// SetWithExpiration inserts an entry in the cache with a requested expiration time.
    	// This will replace any entry with the same key that is already in the cache.
    	// The entry will be automatically expunged from the cache at or slightly after the
    	// requested expiration time.
    	SetWithExpiration(key any, value any, expiration time.Duration)
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  4. pkg/cache/ttlCache.go

    		}
    		return true
    	})
    }
    
    func (c *ttlCache) EvictExpired() {
    	c.evictExpired(time.Now())
    }
    
    func (c *ttlCache) Set(key any, value any) {
    	c.SetWithExpiration(key, value, c.defaultExpiration)
    }
    
    func (c *ttlCache) SetWithExpiration(key any, value any, expiration time.Duration) {
    	e := &entry{
    		value:      value,
    		expiration: atomic.LoadInt64(&c.baseTimeNanos) + expiration.Nanoseconds(),
    	}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 7.8K bytes
    - Viewed (0)
Back to top