cache

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is returned when the key is not found.
	ErrKeyNotFound = errors.New("key not found")

	// ErrUnknown is returned when the error is unknown.
	ErrUnknown = errors.New("unknown error")
)

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Store

	Missing(key string) bool
	Pull(key string, value interface{}) error
	Set(key string, value interface{}, ttl time.Duration) bool
	Add(key string, value interface{}, ttl time.Duration) bool
	Remember(key string, value interface{}, ttl time.Duration, callback func() interface{}) error
	RememberForever(key string, value interface{}, callback func() interface{}) error
	Delete(key string) bool
	Clear() bool
}

type Store

type Store interface {
	Has(key string) bool

	Get(key string, value interface{}) error

	Put(key string, value interface{}, ttl time.Duration) bool

	Increment(key string, value int) int

	Decrement(key string, value int) int

	Forever(key string, value interface{}) bool

	Forget(key string) bool

	Flush() bool

	GetPrefix() string
}

type StoreAddable

type StoreAddable interface {
	Add(key string, value interface{}, ttl time.Duration) bool
}

type StorePullable

type StorePullable interface {
	Pull(key string, value interface{}) error
}

Jump to

Keyboard shortcuts

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