cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Cache provides a simple marshaling layer on top of the store

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCacheSize = 1000

	DefaultCache = New(nil)

	ErrNotFound = errors.New("not found")
)

Functions

func Decrement

func Decrement(key string, val int64) (int64, error)

func Delete

func Delete(key string) error

func Get

func Get(key string, val interface{}) (time.Time, error)

func Increment

func Increment(key string, val int64) (int64, error)

func ListKeys added in v0.25.0

func ListKeys() ([]string, error)

func Set

func Set(key string, val interface{}, expires time.Time) error

Types

type Cache

type Cache interface {
	// Context returns a tenant scoped Cache
	Context(ctx context.Context) Cache
	Get(key string, val interface{}) (time.Time, error)
	Set(key string, val interface{}, expires time.Time) error
	Delete(key string) error
	Increment(key string, val int64) (int64, error)
	Decrement(key string, val int64) (int64, error)
	ListKeys() ([]string, error)
	Close() error
}

func Context

func Context(ctx context.Context) Cache

func New

func New(st store.Store) Cache

Jump to

Keyboard shortcuts

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