cache

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsErrNoRecord added in v0.2.0

func AsErrNoRecord(e error) bool

Types

type Cache

type Cache interface {
	Set(key string, val interface{}) error
	Get(key string, val interface{}) error
	Drop(key string) error
}

type ErrNoRecord added in v0.2.0

type ErrNoRecord struct{}

func (*ErrNoRecord) Error added in v0.2.0

func (e *ErrNoRecord) Error() string

type Memory

type Memory struct {
	C   *cache.Cache
	TTL time.Duration
}

func NewMemory

func NewMemory(ttl time.Duration) *Memory

func (*Memory) Drop

func (m *Memory) Drop(key string) error

func (*Memory) Get

func (m *Memory) Get(key string, value interface{}) error

func (*Memory) Set

func (m *Memory) Set(key string, val interface{}) error

type NamedCache

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

func Named

func Named(prefix string, c Cache) *NamedCache

func (*NamedCache) Drop

func (c *NamedCache) Drop(key string) error

func (*NamedCache) Get

func (c *NamedCache) Get(key string, val interface{}) error

func (*NamedCache) Set

func (c *NamedCache) Set(key string, val interface{}) error

type Redis added in v0.2.0

type Redis struct {
	C   *cache.Cache
	TTL time.Duration
}

func NewRedis added in v0.2.0

func NewRedis(dsn string, ttl time.Duration) (*Redis, error)

func (*Redis) Drop added in v0.2.0

func (r *Redis) Drop(key string) error

func (*Redis) Get added in v0.2.0

func (r *Redis) Get(key string, val interface{}) error

func (*Redis) Set added in v0.2.0

func (r *Redis) Set(key string, val interface{}) error

Jump to

Keyboard shortcuts

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