cache

package
v0.0.0-...-2af310e Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

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

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