cacheman

package module
v0.0.0-...-99a1252 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyDoesNotExist  error = errors.New(`key does not exist`)
	ErrKeyNotSet        error = errors.New(`key not set`)
	ErrKeyPatternNotSet error = errors.New(`key pattern not set`)
)

Functions

This section is empty.

Types

type CacheManager

type CacheManager struct {
	MaxLength int
	// contains filtered or unexported fields
}

CacheManager manage fastcache. This extends the github.com/VictoriaMetrics/fastcache to have a Del that supports wildcards

func New

func New(max int) *CacheManager

New creates a new CacheManager

func (*CacheManager) Del

func (cm *CacheManager) Del(keyPattern string) error

Del deletes an item or items with the pattern in the cache

func (*CacheManager) Get

func (cm *CacheManager) Get(dst []byte, key string) []byte

Get the cache content

func (*CacheManager) GetWithErr

func (cm *CacheManager) GetWithErr(key string) ([]byte, error)

GetWithErr get the cache content with error

func (*CacheManager) Has

func (cm *CacheManager) Has(key string) bool

Has checks if a cache item is present in the cache

func (*CacheManager) ListKeys

func (cm *CacheManager) ListKeys() []string

ListKeys gets the list of keys

func (*CacheManager) Reset

func (cm *CacheManager) Reset()

Reset resets the cache content

func (*CacheManager) Set

func (cm *CacheManager) Set(key string, value []byte) error

Set the cache

Jump to

Keyboard shortcuts

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