Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for SetWithExpiration (0.19 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)
  5. pkg/ledger/smt.go

    		// moving up a shortcut, we dont record every single move
    		s.db.updatedMux.Lock()
    		// mark for expiration?
    		if val, ok := s.db.updatedNodes.Get(node); ok {
    			s.db.updatedNodes.SetWithExpiration(node, val, s.retentionDuration)
    		}
    		s.db.updatedMux.Unlock()
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Aug 08 16:43:05 UTC 2023
    - 14K bytes
    - Viewed (0)
Back to top