cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const NilReply = aredis.RedisNil

NilReply represent Redis nil reply, .e.g. when key does not exist.

Variables

This section is empty.

Functions

func IsCacheErr

func IsCacheErr(err error) bool

IsCacheErr will ignore redis.nil for error handler

Types

type Cache

type Cache interface {
	Reader() aredis.Commander
	Writer() aredis.Commander
}

Cache interface to describe a Cache client

type RedisCache

type RedisCache struct {
	Read  *aredis.Client
	Write *aredis.Client
}

RedisCache abstraction used to store a redis connection

func NewAlaudaRedis

func NewAlaudaRedis(opts aredis.Options, writerOpts aredis.Options) (*RedisCache, error)

NewAlaudaRedis construtor based on alauda redis client

func NewRedis

func NewRedis(opts RedisOpts, writeOpts RedisOpts) (*RedisCache, error)

NewRedis constructor method for a new Redis cache

func (*RedisCache) Diagnose

func (r *RedisCache) Diagnose() diagnose.ComponentReport

Diagnose start diagnose check http://confluence.alaudatech.com/pages/viewpage.action?pageId=14123161

func (*RedisCache) Reader

func (r *RedisCache) Reader() aredis.Commander

Reader returns a read commander

func (*RedisCache) Writer

func (r *RedisCache) Writer() aredis.Commander

Writer returns a write commander

type RedisOpts

type RedisOpts struct {
	Host     string
	Port     int
	DB       int
	Password string
}

RedisOpts abstraction for connection settings

func (RedisOpts) GetAddr

func (r RedisOpts) GetAddr() string

GetAddr will return a string of the addres which is host:port

Jump to

Keyboard shortcuts

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