cache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObjectTooLarge = errors.New("object too large")
	ErrNoSpace        = errors.New("out of memory")
	ErrNonNumeric     = errors.New("cannot increment or decrement non-numeric value")
	ErrOverflow       = errors.New("increment or decrement overflow")
)

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(maxBytes, targetBytes, entryOverhead int64, maxEvictPerOp int, incrSlidingTTLSeconds int64) *Cache

func (*Cache) Decr

func (c *Cache) Decr(key string, delta uint64) (uint64, error)

func (*Cache) Delete

func (c *Cache) Delete(key string) bool

func (*Cache) Get

func (c *Cache) Get(key string) (*Item, bool)

func (*Cache) Incr

func (c *Cache) Incr(key string, delta uint64) (uint64, error)

func (*Cache) Set

func (c *Cache) Set(key string, flags uint32, value []byte) error

type Item

type Item struct {
	Value []byte

	Flags uint32
	Size  int64
	CAS   uint64

	// ExpUnix is Unix seconds. 0 means no expiration.
	ExpUnix int64
}

Jump to

Keyboard shortcuts

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