Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for func (0.14 sec)

  1. internal/cachevalue/cache.go

    // guaranteed to be called only once.
    func (t *Cache[T]) InitOnce(ttl time.Duration, opts Opts, update func() (T, error)) {
    	t.Once.Do(func() {
    		t.ttl = ttl
    		t.updateFn = update
    		t.opts = opts
    	})
    }
    
    // Get will return a cached value or fetch a new one.
    // Tf the Update function returns an error the value is forwarded as is and not cached.
    func (t *Cache[T]) Get() (T, error) {
    	v := t.valErr.Load()
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Mar 01 16:00:42 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  2. internal/config/cache/cache.go

    func (c *Config) Enabled() bool {
    	return c.Enable && c.Endpoint != ""
    }
    
    // MatchesSize verifies if input 'size' falls under cacheable threshold
    func (c Config) MatchesSize(size int64) bool {
    	configLock.RLock()
    	defer configLock.RUnlock()
    
    	return c.Enable && c.BlockSize > 0 && size <= c.BlockSize
    }
    
    // Update updates new cache frequency
    func (c *Config) Update(ncfg Config) {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 5.6K bytes
    - Viewed (0)
Back to top