Documentation ¶
Index ¶
- type Cache
- func (c *Cache) Get(dst, key []byte) []byte
- func (c *Cache) GetBig(dst, key []byte) []byte
- func (c *Cache) Has(key []byte) bool
- func (c *Cache) Reset()
- func (c *Cache) Save(filePath string) error
- func (c *Cache) Set(key, value []byte)
- func (c *Cache) SetBig(key, value []byte)
- func (c *Cache) Stop()
- func (c *Cache) UpdateStats(fcs *fastcache.Stats)
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 ¶
Load loads the cache from filePath and limits its size to maxBytes and evicts inactive entries in 20 minutes.
Stop must be called on the returned cache when it is no longer needed.
func LoadWithExpire ¶ added in v1.74.0
LoadWithExpire loads the cache from filePath and limits its size to maxBytes and evicts inactive entires after expireDuration.
Stop must be called on the returned cache when it is no longer needed.
func New ¶
New creates new cache with the given maxBytes capacity.
Stop must be called on the returned cache when it is no longer needed.
func NewWithExpire ¶ added in v1.74.0
NewWithExpire creates new cache with the given maxBytes capacity and the given expireDuration for inactive entries.
Stop must be called on the returned cache when it is no longer needed.
func (*Cache) GetBig ¶
GetBig appends the found value for the given key to dst and returns the result.
func (*Cache) Stop ¶
func (c *Cache) Stop()
Stop stops the cache.
The cache cannot be used after the Stop call.
func (*Cache) UpdateStats ¶
UpdateStats updates fcs with cache stats.