cache

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 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 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