cache

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addable

type Addable interface {
	Add(ctx context.Context, key string, value interface{}, ttl time.Duration) (bool, error)
}

type Manager added in v2.8.0

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

func NewManager added in v2.8.0

func NewManager(repository Repository) *Manager

func (*Manager) Driver added in v2.8.0

func (m *Manager) Driver(names ...string) Repository

func (*Manager) Register added in v2.8.0

func (m *Manager) Register(name string, repository Repository)

type Repository

type Repository interface {
	Store
	Addable

	Missing(ctx context.Context, key string) (bool, error)
	Delete(ctx context.Context, key string) (bool, error)
	Set(ctx context.Context, key string, value interface{}, ttl time.Duration) (bool, error)
	Remember(ctx context.Context, key string, dest interface{}, value func() interface{}, ttl time.Duration) error
}

func NewRepository

func NewRepository(store Store) Repository

type Store

type Store interface {
	Has(ctx context.Context, key string) (bool, error)

	Get(ctx context.Context, key string, dest interface{}) error

	Put(ctx context.Context, key string, value interface{}, ttl time.Duration) (bool, error)

	Increment(ctx context.Context, key string, value int) (int, error)

	Decrement(ctx context.Context, key string, value int) (int, error)

	Forever(ctx context.Context, key string, value interface{}) (bool, error)

	Forget(ctx context.Context, key string) (bool, error)

	Flush(ctx context.Context) (bool, error)

	GetPrefix() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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