cache

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDestMustBePointer = fmt.Errorf("cache: dest must be a pointer")
	ErrDestMustNotBeNil  = fmt.Errorf("cache: dest must not be nil")
)

Functions

func NewRepository added in v1.0.5

func NewRepository(store cache.Store) cache.Repository

Types

type Config added in v1.0.5

type Config struct {
	Default string

	Stores map[string]cache.Store
}

type Manager added in v1.0.5

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

func NewManager added in v1.0.5

func NewManager(config *Config) *Manager

func (*Manager) Connect added in v1.0.5

func (m *Manager) Connect(names ...string) cache.Repository

type Repository

type Repository struct {
	cache.Store
}

func (*Repository) Add

func (r *Repository) Add(ctx context.Context, key string, value interface{}, ttl time.Duration) (bool, error)

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, key string) error

func (*Repository) Missing

func (r *Repository) Missing(ctx context.Context, key string) bool

func (*Repository) Remember

func (r *Repository) Remember(ctx context.Context, key string, dest interface{}, value func() interface{}, ttl time.Duration) error

func (*Repository) Set

func (r *Repository) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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