cache

package
v0.0.0-...-70e99ff Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_EXPIRATION_DATE_EXPIRED    = errors.New("error expiration date")
	ERR_DRIVER_NOT_SUPPORTED_VALUE = errors.New("driver not supported value")
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Get(ctx context.Context, key interface{}) (value interface{}, exist bool, err error)
	Set(ctx context.Context, key interface{}, value interface{}, Expiration int) (err error)
	Delete(ctx context.Context, key interface{}) (err error)
	Clear() (err error)
}

func NewFreeCacheBackend

func NewFreeCacheBackend(bytesCacheSize int) Backend

type Cache

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

func New

func New(storage Backend) *Cache

func (*Cache) Load

func (c *Cache) Load(ctx context.Context) CacheInterface

type CacheInterface

type CacheInterface interface {
	Get(key interface{}) (value interface{}, exist bool, err error)
	Set(key, object interface{}, Expiration int) (err error)
	Delete(key interface{}) (err error)
	Clear() (err error)
}

type Freecache

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

func (*Freecache) Clear

func (f *Freecache) Clear() (err error)

func (*Freecache) Delete

func (f *Freecache) Delete(ctx context.Context, key interface{}) (err error)

func (*Freecache) Get

func (f *Freecache) Get(ctx context.Context, key interface{}) (value interface{}, exist bool, err error)

func (*Freecache) Set

func (f *Freecache) Set(ctx context.Context, key interface{}, value interface{}, Expiration int) (err error)

type Interface

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

func (*Interface) Clear

func (i *Interface) Clear() (err error)

func (*Interface) Delete

func (i *Interface) Delete(key interface{}) (err error)

func (*Interface) Get

func (i *Interface) Get(key interface{}) (val interface{}, exist bool, err error)

func (*Interface) Set

func (i *Interface) Set(key, value interface{}, expiration int) (err error)

Jump to

Keyboard shortcuts

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