cache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound    = errors.New("cache: not found")
	ErrInvalidType = errors.New("cache: not expected type")
)

Functions

func Bytes

func Bytes(value interface{}) ([]byte, error)

func MakeHashSlotKey

func MakeHashSlotKey(hashTag, id, environmentNamespace string) string

MakeHashSlotKey creates a key to ensure that multiple keys are allocated in the same hash slot. https://redis.io/topics/cluster-spec#keys-hash-tags

func MakeKey

func MakeKey(kind, id, environmentNamespace string) string

func MakeKeyPrefix

func MakeKeyPrefix(kind, environmentNamespace string) string

Types

type Cache

type Cache interface {
	Getter
	Putter
}

type Counter added in v0.2.0

type Counter interface {
	Increment(key string) (int64, error)
	PFAdd(key string, els ...string) (int64, error)
}

type Deleter

type Deleter interface {
	Delete(key string) error
}

type Expirer added in v0.2.0

type Expirer interface {
	Expire(key string, expiration time.Duration) (bool, error)
}

type Getter

type Getter interface {
	Get(key interface{}) (interface{}, error)
}

type Lister

type Lister interface {
	Keys(pattern string, maxSize int) ([]string, error)
}

FIXME: remove after persistent-redis migration

type MultiGetCache

type MultiGetCache interface {
	Cache
	MultiGetter
}

type MultiGetDeleteCountCache added in v0.2.0

type MultiGetDeleteCountCache interface {
	MultiGetCache
	Deleter
	Counter
	PipeLiner
	Expirer
	PFGetter
	PFMerger
}

type MultiGetter

type MultiGetter interface {
	GetMulti(keys interface{}) ([]interface{}, error)
	Scan(cursor, key, count interface{}) (uint64, []string, error)
}

type PFGetter added in v0.3.0

type PFGetter interface {
	PFCount(keys ...string) (int64, error)
}

type PFMerger added in v0.3.0

type PFMerger interface {
	PFMerge(dest string, keys ...string) error
}

type PipeLiner added in v0.2.0

type PipeLiner interface {
	Pipeline() redis.PipeClient
}

type Putter

type Putter interface {
	Put(key interface{}, value interface{}, expiration time.Duration) error
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
v3
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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