cacheman

package module
v0.0.0-...-2531138 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 value of the key from the cache

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, exp int) error

Set a value for a key

Jump to

Keyboard shortcuts

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