backend

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCleanupInterval = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Set(key string, value interface{}, duration time.Duration)
	Get(key string) (interface{}, bool)
	Delete(key string) error
}

type MemoryBackend

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

func NewMemoryBackend

func NewMemoryBackend(name string, expiration time.Duration) *MemoryBackend

func (*MemoryBackend) Delete added in v0.0.3

func (c *MemoryBackend) Delete(key string) error

func (*MemoryBackend) Get

func (c *MemoryBackend) Get(key string) (interface{}, bool)

func (*MemoryBackend) Set

func (c *MemoryBackend) Set(key string, value interface{}, duration time.Duration)

type RedisBackend

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

func NewRedisBackend

func NewRedisBackend(name string, cli *redis.Client, expiration time.Duration) *RedisBackend

func (*RedisBackend) Delete added in v0.0.3

func (c *RedisBackend) Delete(key string) error

func (*RedisBackend) Get

func (c *RedisBackend) Get(key string) (interface{}, bool)

func (*RedisBackend) Set

func (c *RedisBackend) Set(key string, value interface{}, duration time.Duration)

Jump to

Keyboard shortcuts

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