workingsetcache

package
v1.98.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a cache for working set entries.

The cache evicts inactive entries after the given expireDuration. Recently accessed entries survive expireDuration.

func Load

func Load(filePath string, maxBytes int) *Cache

Load loads the cache from filePath and limits its size to maxBytes and evicts inactive entries in *cacheExpireDuration minutes.

Stop must be called on the returned cache when it is no longer needed.

func New

func New(maxBytes int) *Cache

New creates new cache with the given maxBytes capacity and *cacheExpireDuration expiration.

Stop must be called on the returned cache when it is no longer needed.

func (*Cache) Get

func (c *Cache) Get(dst, key []byte) []byte

Get appends the found value for the given key to dst and returns the result.

func (*Cache) GetBig

func (c *Cache) GetBig(dst, key []byte) []byte

GetBig appends the found value for the given key to dst and returns the result.

func (*Cache) Has

func (c *Cache) Has(key []byte) bool

Has verifies whether the cache contains the given key.

func (*Cache) Reset

func (c *Cache) Reset()

Reset resets the cache.

func (*Cache) Save

func (c *Cache) Save(filePath string) error

Save saves the cache to filePath.

func (*Cache) Set

func (c *Cache) Set(key, value []byte)

Set sets the given value for the given key.

func (*Cache) SetBig

func (c *Cache) SetBig(key, value []byte)

SetBig sets the given value for the given key.

func (*Cache) Stop

func (c *Cache) Stop()

Stop stops the cache.

The cache cannot be used after the Stop call.

func (*Cache) UpdateStats

func (c *Cache) UpdateStats(fcs *fastcache.Stats)

UpdateStats updates fcs with cache stats.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL