Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for NewTTL (0.08 sec)

  1. pkg/cache/ttlCache_test.go

    	c := NewTTL(5*time.Minute, 1*time.Minute)
    	benchmarkCacheSet(c, b)
    }
    
    func BenchmarkTTLSetConcurrent(b *testing.B) {
    	c := NewTTL(5*time.Minute, 1*time.Minute)
    	benchmarkCacheSetConcurrent(c, b)
    }
    
    func BenchmarkTTLGetSetConcurrent(b *testing.B) {
    	c := NewTTL(5*time.Minute, 1*time.Minute)
    	benchmarkCacheGetSetConcurrent(c, b)
    }
    
    func BenchmarkTTLSetRemove(b *testing.B) {
    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/ttlCache.go

    // long enough expiration time. Don't do that.
    func NewTTL(defaultExpiration time.Duration, evictionInterval time.Duration) ExpiringCache {
    	return NewTTLWithCallback(defaultExpiration, evictionInterval, func(key, value any) {})
    }
    
    // NewTTLWithCallback creates a new cache with a time-based eviction model that will invoke the supplied
    // callback on all evictions. See also: NewTTL.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  3. pkg/ledger/smt_test.go

    	// Add data to empty trie
    	keys := getFreshData(10)
    	values := getFreshData(10)
    	_, err := smt.Update(keys, values)
    	assert.NoError(t, err)
    	smt.db.updatedNodes = byteCache{cache: cache.NewTTL(forever, time.Minute)}
    	smt.loadDefaultHashes()
    
    	// Check errors are raised is a keys is not in cache nor db
    	for _, key := range keys {
    		_, err := smt.Get(key)
    		assert.Error(t, err)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Aug 08 16:43:05 UTC 2023
    - 7.9K bytes
    - Viewed (0)
  4. pkg/ledger/smt.go

    // duration for old nodes.
    func newSMT(hash func(data ...[]byte) []byte, updateCache cache.ExpiringCache, retentionDuration time.Duration) *smt {
    	if updateCache == nil {
    		updateCache = cache.NewTTL(forever, time.Second)
    	}
    	s := &smt{
    		hash:              hash,
    		trieHeight:        len(hash([]byte("height"))) * 8, // hash any string to get output length
    		retentionDuration: retentionDuration,
    	}
    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