key

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCallableRequired = errors.New("callable is required")
View Source
var ErrKeyGeneratorParamsKeyRequired = errors.New("missing 'key' in key generator data")
View Source
var ErrKeyGeneratorParamsNamespaceRequired = errors.New("missing 'namespace' in key generator data")
View Source
var ErrKeyGeneratorParamsPrefixRequired = errors.New("missing 'prefix' in key generator data")

key generator errors

View Source
var ErrKeyGeneratorParamsVersionRequired = errors.New("missing 'version' in key generator data")
View Source
var ErrNameRequired = errors.New("name is required")

custom key function errors

View Source
var ErrParamsRequired = errors.New("params is required")

Functions

func KeyGenerator

func KeyGenerator(data map[string]string) (string, error)

KeyGenerator generates a simple cache key. Template: {prefix}:{key}.gob

func KeyVersionGenerator

func KeyVersionGenerator(data map[string]string) (string, error)

KeyVersionGenerator generates a versioned cache key. Template: {prefix}:{namespace}:v{version}-{key}.gob

func LockGenerator

func LockGenerator(data map[string]string) (string, error)

LockGenerator generates a lock key. Template: {prefix}:{namespace}:lock

func VersionGenerator

func VersionGenerator(data map[string]string) (string, error)

VersionGenerator generates a version key. Template: {prefix}:{namespace}:version

Types

type CustomKeyFunction

type CustomKeyFunction interface {
	Name() string
	Call(params map[string]interface{}) (string, error)
	Callable(args ...interface{}) string
}

func NewCustomKeyFunction

func NewCustomKeyFunction(
	name string,
	callable func(args ...interface{}) string,
	params []string,
) (CustomKeyFunction, error)

type KeyGeneratorFunc

type KeyGeneratorFunc func(data map[string]string) (string, error)

KeyGeneratorFunc generates a cache key from data.

Jump to

Keyboard shortcuts

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