freesia

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 11 Imported by: 0

README

Freesia

Freesia is a multilevel cache backed by redis and roc.

Feature

  • Customize codec
  • Using Redis subscription to delete cache asynchronously.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error string

Error 错误类型

func (Error) Error

func (e Error) Error() string

Error 错误接口

type Freesia

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

Freesia 多级缓存

func New

func New(store Store, setters ...Setter) (*Freesia, error)

New 生成一个实例

func (*Freesia) Del

func (f *Freesia) Del(keys ...string) error

Del deletes keys.

func (*Freesia) Get

func (f *Freesia) Get(e *entry.Entry) error

Get gets value.

func (*Freesia) MGet

func (f *Freesia) MGet(es ...*entry.Entry) ([]*entry.Entry, error)

MGet batch get entries.

func (*Freesia) MSet

func (f *Freesia) MSet(es ...*entry.Entry) error

MSet batch sets entries.

func (*Freesia) Set

func (f *Freesia) Set(e *entry.Entry) error

Set sets a key-value.

type Setter

type Setter func(f *Freesia) error

Setter 配置函数

func WithChannel added in v0.5.0

func WithChannel(channel string) Setter

WithChannel sets the pub sub channel.

func WithDebug added in v0.5.0

func WithDebug() Setter

WithDebug sets the debug mode.

type Store

type Store interface {
	Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	MSet(pairs ...interface{}) *redis.StatusCmd
	Get(key string) *redis.StringCmd
	MGet(keys ...string) *redis.SliceCmd
	Del(keys ...string) *redis.IntCmd
	Pipeline() redis.Pipeliner
	Subscribe(channels ...string) *redis.PubSub
	Publish(channel string, message interface{}) *redis.IntCmd
}

Store represents redis op.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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