redis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

@Time : 2019-05-28 15:22 @Author : frozenchen @File : Item @Software: studio

@Time : 2019-05-10 09:55 @Author : frozenchen @File : config @Software: studio-library

@Time : 2019-05-28 15:33 @Author : frozenchen @File : error @Software: studio

@Time : 2019-05-10 09:55 @Author : frozenchen @File : redis @Software: studio-library

Index

Constants

View Source
const (
	JSONFLAG = "json"
)

Variables

View Source
var (
	ErrKey      = errors.New("redis: key is empty")
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr         string
	Auth         string
	Idle         int
	Active       int
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
}

type Item added in v0.0.6

type Item struct {
	// Key is the Item's key (250 bytes maximum).
	Key string

	// Value is the Item's value.
	Value []byte

	// Object is the Item's object for use codec.
	Object interface{}

	// Flags are server-opaque flags whose semantics are entirely
	// up to the app.
	Flags uint32

	// Expiration is the cache expiration time, in seconds: either a relative
	// time from now (up to 1 month), or an absolute Unix epoch time.
	// Zero means the Item has no expiration time.
	Expiration int32
	// contains filtered or unexported fields
}

type Redis

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

func New

func New(c *Config) *Redis

func (*Redis) CaCheSet added in v0.0.6

func (r *Redis) CaCheSet(ctx context.Context, item *Item) (err error)

func (*Redis) CacheGet added in v0.0.6

func (r *Redis) CacheGet(ctx context.Context, key string) (reply *Reply)

func (*Redis) CacheGetMulti added in v0.0.6

func (r *Redis) CacheGetMulti(ctx context.Context, keys []string) (res *Replies, err error)

func (*Redis) Delete added in v0.0.6

func (r *Redis) Delete(ctx context.Context, key string) (err error)

func (*Redis) Deletes added in v0.0.15

func (r *Redis) Deletes(ctx context.Context, key string) (err error)

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, key string) ([]byte, error)

func (*Redis) GetConn added in v0.0.13

func (r *Redis) GetConn() redis.Conn

func (*Redis) Set added in v0.0.13

func (r *Redis) Set(ctx context.Context, key string, value interface{}, Exp int) (err error)

type Replies added in v0.0.6

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

Replies is the result of GetMulti

func (*Replies) Scan added in v0.0.6

func (r *Replies) Scan(key string, item interface{}) (err error)

type Reply added in v0.0.6

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

Reply is the result of CacheGet

func (*Reply) Scan added in v0.0.6

func (r *Reply) Scan(item interface{}) (err error)

Jump to

Keyboard shortcuts

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