cache

package
v5.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanAllGroups

func CleanAllGroups()

CleanAllGroups cleans all keys tat:users:*:groups tat:users:*:groups:*

func CleanAllTopicsLists

func CleanAllTopicsLists()

CleanAllTopicsLists cleans all keys tat:users:*:topics tat:users:*:topics:*

func CleanMessagesLists

func CleanMessagesLists(topic string)

CleanMessagesLists cleans tat:messages:<topic>

func CleanTopicByName

func CleanTopicByName(topicName string)

CleanTopicByName cleans cache for a topic

func CleanUsernames

func CleanUsernames(usernames ...string)

CleanUsernames cleans tat:users:<username>

func CriteriaKey

func CriteriaKey(i tat.CacheableCriteria, s ...string) string

CriteriaKey returns the Redis Key

func FlushDB

func FlushDB() (string, error)

FlushDB flush cache

func Info

func Info() (string, error)

Info returns informations on cache

func Key

func Key(s ...string) string

Key convert string array in redis key

func TatGroupsKeys

func TatGroupsKeys() []string

TatGroupsKeys returns cache keys for groups

func TatMessagesKeys

func TatMessagesKeys() []string

TatMessagesKeys returns cache keys for messages

func TatTopicsKeys

func TatTopicsKeys() []string

TatTopicsKeys returns cache key for topics

func TestInstanceAtStartup

func TestInstanceAtStartup()

TestInstanceAtStartup pings redis and display error log if no redis, and Info log is redis is here

Types

type Cache

type Cache interface {
	Append(key, value string) *redis.IntCmd
	BLPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
	BRPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
	BRPopLPush(source, destination string, timeout time.Duration) *redis.StringCmd
	Decr(key string) *redis.IntCmd
	DecrBy(key string, decrement int64) *redis.IntCmd
	Del(keys ...string) *redis.IntCmd
	Exists(key string) *redis.BoolCmd
	Expire(key string, expiration time.Duration) *redis.BoolCmd
	ExpireAt(key string, tm time.Time) *redis.BoolCmd
	FlushDb() *redis.StatusCmd
	Get(key string) *redis.StringCmd
	GetBit(key string, offset int64) *redis.IntCmd
	GetRange(key string, start, end int64) *redis.StringCmd
	GetSet(key string, value interface{}) *redis.StringCmd
	HDel(key string, fields ...string) *redis.IntCmd
	HExists(key, field string) *redis.BoolCmd
	HGet(key, field string) *redis.StringCmd
	HGetAll(key string) *redis.StringStringMapCmd
	HIncrBy(key, field string, incr int64) *redis.IntCmd
	HKeys(key string) *redis.StringSliceCmd
	HLen(key string) *redis.IntCmd
	HMGet(key string, fields ...string) *redis.SliceCmd
	HMSet(key string, fields map[string]string) *redis.StatusCmd
	HScan(key string, cursor uint64, match string, count int64) redis.Scanner
	HSet(key, field, value string) *redis.BoolCmd
	HSetNX(key, field, value string) *redis.BoolCmd
	HVals(key string) *redis.StringSliceCmd
	Incr(key string) *redis.IntCmd
	IncrBy(key string, value int64) *redis.IntCmd
	Info(section ...string) *redis.StringCmd
	LIndex(key string, index int64) *redis.StringCmd
	LInsert(key, op string, pivot, value interface{}) *redis.IntCmd
	LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd
	LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd
	LLen(key string) *redis.IntCmd
	LPop(key string) *redis.StringCmd
	LPush(key string, values ...interface{}) *redis.IntCmd
	LPushX(key string, value interface{}) *redis.IntCmd
	LRange(key string, start, stop int64) *redis.StringSliceCmd
	LRem(key string, count int64, value interface{}) *redis.IntCmd
	LSet(key string, index int64, value interface{}) *redis.StatusCmd
	LTrim(key string, start, stop int64) *redis.StatusCmd
	MGet(keys ...string) *redis.SliceCmd
	MSet(pairs ...interface{}) *redis.StatusCmd
	MSetNX(pairs ...interface{}) *redis.BoolCmd
	PExpire(key string, expiration time.Duration) *redis.BoolCmd
	PExpireAt(key string, tm time.Time) *redis.BoolCmd
	Ping() *redis.StatusCmd
	PTTL(key string) *redis.DurationCmd
	Persist(key string) *redis.BoolCmd
	Pipeline() *redis.Pipeline
	PubSubChannels(pattern string) *redis.StringSliceCmd
	PubSubNumPat() *redis.IntCmd
	Publish(channel, message string) *redis.IntCmd
	RPop(key string) *redis.StringCmd
	RPopLPush(source, destination string) *redis.StringCmd
	RPush(key string, values ...interface{}) *redis.IntCmd
	RPushX(key string, value interface{}) *redis.IntCmd
	Rename(key, newkey string) *redis.StatusCmd
	RenameNX(key, newkey string) *redis.BoolCmd
	SAdd(key string, members ...interface{}) *redis.IntCmd
	SCard(key string) *redis.IntCmd
	SDiff(keys ...string) *redis.StringSliceCmd
	SDiffStore(destination string, keys ...string) *redis.IntCmd
	SInter(keys ...string) *redis.StringSliceCmd
	SInterStore(destination string, keys ...string) *redis.IntCmd
	SIsMember(key string, member interface{}) *redis.BoolCmd
	SMembers(key string) *redis.StringSliceCmd
	SMove(source, destination string, member interface{}) *redis.BoolCmd
	SPop(key string) *redis.StringCmd
	SPopN(key string, count int64) *redis.StringSliceCmd
	SRandMember(key string) *redis.StringCmd
	SRandMemberN(key string, count int64) *redis.StringSliceCmd
	SRem(key string, members ...interface{}) *redis.IntCmd
	SScan(key string, cursor uint64, match string, count int64) redis.Scanner
	SUnion(keys ...string) *redis.StringSliceCmd
	SUnionStore(destination string, keys ...string) *redis.IntCmd
	Scan(cursor uint64, match string, count int64) redis.Scanner
	Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	SetBit(key string, offset int64, value int) *redis.IntCmd
	SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd
	SetRange(key string, offset int64, value string) *redis.IntCmd
	SetXX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd
	Sort(key string, sort redis.Sort) *redis.StringSliceCmd
	StrLen(key string) *redis.IntCmd
	TTL(key string) *redis.DurationCmd
	Type(key string) *redis.StatusCmd
	ZAdd(key string, members ...redis.Z) *redis.IntCmd
	ZAddCh(key string, members ...redis.Z) *redis.IntCmd
	ZAddNX(key string, members ...redis.Z) *redis.IntCmd
	ZAddNXCh(key string, members ...redis.Z) *redis.IntCmd
	ZAddXX(key string, members ...redis.Z) *redis.IntCmd
	ZAddXXCh(key string, members ...redis.Z) *redis.IntCmd
	ZCard(key string) *redis.IntCmd
	ZCount(key, min, max string) *redis.IntCmd
	ZIncr(key string, member redis.Z) *redis.FloatCmd
	ZIncrBy(key string, increment float64, member string) *redis.FloatCmd
	ZIncrNX(key string, member redis.Z) *redis.FloatCmd
	ZIncrXX(key string, member redis.Z) *redis.FloatCmd
	ZInterStore(destination string, store redis.ZStore, keys ...string) *redis.IntCmd
	ZRange(key string, start, stop int64) *redis.StringSliceCmd
	ZRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd
	ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
	ZRank(key, member string) *redis.IntCmd
	ZRem(key string, members ...interface{}) *redis.IntCmd
	ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd
	ZRemRangeByScore(key, min, max string) *redis.IntCmd
	ZRevRange(key string, start, stop int64) *redis.StringSliceCmd
	ZRevRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRevRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd
	ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
	ZRevRank(key, member string) *redis.IntCmd
	ZScan(key string, cursor uint64, match string, count int64) redis.Scanner
	ZScore(key, member string) *redis.FloatCmd
	ZUnionStore(dest string, store redis.ZStore, keys ...string) *redis.IntCmd
}

Cache interface redis

func Client

func Client() Cache

Client returns Cache interface

type LocalCache

type LocalCache struct{}

LocalCache is a dummy struct

func (*LocalCache) Append

func (c *LocalCache) Append(key, value string) *redis.IntCmd

func (*LocalCache) BLPop

func (c *LocalCache) BLPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd

func (*LocalCache) BRPop

func (c *LocalCache) BRPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd

func (*LocalCache) BRPopLPush

func (c *LocalCache) BRPopLPush(source, destination string, timeout time.Duration) *redis.StringCmd

func (*LocalCache) Decr

func (c *LocalCache) Decr(key string) *redis.IntCmd

func (*LocalCache) DecrBy

func (c *LocalCache) DecrBy(key string, decrement int64) *redis.IntCmd

func (*LocalCache) Del

func (c *LocalCache) Del(keys ...string) *redis.IntCmd

func (*LocalCache) Exists

func (c *LocalCache) Exists(key string) *redis.BoolCmd

func (*LocalCache) Expire

func (c *LocalCache) Expire(key string, expiration time.Duration) *redis.BoolCmd

func (*LocalCache) ExpireAt

func (c *LocalCache) ExpireAt(key string, tm time.Time) *redis.BoolCmd

func (*LocalCache) FlushDb

func (c *LocalCache) FlushDb() *redis.StatusCmd

func (*LocalCache) Get

func (c *LocalCache) Get(key string) *redis.StringCmd

func (*LocalCache) GetBit

func (c *LocalCache) GetBit(key string, offset int64) *redis.IntCmd

func (*LocalCache) GetRange

func (c *LocalCache) GetRange(key string, start, end int64) *redis.StringCmd

func (*LocalCache) GetSet

func (c *LocalCache) GetSet(key string, value interface{}) *redis.StringCmd

func (*LocalCache) HDel

func (c *LocalCache) HDel(key string, fields ...string) *redis.IntCmd

func (*LocalCache) HExists

func (c *LocalCache) HExists(key, field string) *redis.BoolCmd

func (*LocalCache) HGet

func (c *LocalCache) HGet(key, field string) *redis.StringCmd

func (*LocalCache) HGetAll

func (c *LocalCache) HGetAll(key string) *redis.StringStringMapCmd

func (*LocalCache) HIncrBy

func (c *LocalCache) HIncrBy(key, field string, incr int64) *redis.IntCmd

func (*LocalCache) HKeys

func (c *LocalCache) HKeys(key string) *redis.StringSliceCmd

func (*LocalCache) HLen

func (c *LocalCache) HLen(key string) *redis.IntCmd

func (*LocalCache) HMGet

func (c *LocalCache) HMGet(key string, fields ...string) *redis.SliceCmd

func (*LocalCache) HMSet

func (c *LocalCache) HMSet(key string, fields map[string]string) *redis.StatusCmd

func (*LocalCache) HScan

func (c *LocalCache) HScan(key string, cursor uint64, match string, count int64) redis.Scanner

func (*LocalCache) HSet

func (c *LocalCache) HSet(key, field, value string) *redis.BoolCmd

func (*LocalCache) HSetNX

func (c *LocalCache) HSetNX(key, field, value string) *redis.BoolCmd

func (*LocalCache) HVals

func (c *LocalCache) HVals(key string) *redis.StringSliceCmd

func (*LocalCache) Incr

func (c *LocalCache) Incr(key string) *redis.IntCmd

func (*LocalCache) IncrBy

func (c *LocalCache) IncrBy(key string, value int64) *redis.IntCmd

func (*LocalCache) Info

func (c *LocalCache) Info(...string) *redis.StringCmd

func (*LocalCache) LIndex

func (c *LocalCache) LIndex(key string, index int64) *redis.StringCmd

func (*LocalCache) LInsert

func (c *LocalCache) LInsert(key, op string, pivot, value interface{}) *redis.IntCmd

func (*LocalCache) LInsertAfter

func (c *LocalCache) LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd

func (*LocalCache) LInsertBefore

func (c *LocalCache) LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd

func (*LocalCache) LLen

func (c *LocalCache) LLen(key string) *redis.IntCmd

func (*LocalCache) LPop

func (c *LocalCache) LPop(key string) *redis.StringCmd

func (*LocalCache) LPush

func (c *LocalCache) LPush(key string, values ...interface{}) *redis.IntCmd

func (*LocalCache) LPushX

func (c *LocalCache) LPushX(key string, value interface{}) *redis.IntCmd

func (*LocalCache) LRange

func (c *LocalCache) LRange(key string, start, stop int64) *redis.StringSliceCmd

func (*LocalCache) LRem

func (c *LocalCache) LRem(key string, count int64, value interface{}) *redis.IntCmd

func (*LocalCache) LSet

func (c *LocalCache) LSet(key string, index int64, value interface{}) *redis.StatusCmd

func (*LocalCache) LTrim

func (c *LocalCache) LTrim(key string, start, stop int64) *redis.StatusCmd

func (*LocalCache) MGet

func (c *LocalCache) MGet(keys ...string) *redis.SliceCmd

func (*LocalCache) MSet

func (c *LocalCache) MSet(pairs ...interface{}) *redis.StatusCmd

func (*LocalCache) MSetNX

func (c *LocalCache) MSetNX(pairs ...interface{}) *redis.BoolCmd

func (*LocalCache) PExpire

func (c *LocalCache) PExpire(key string, expiration time.Duration) *redis.BoolCmd

func (*LocalCache) PExpireAt

func (c *LocalCache) PExpireAt(key string, tm time.Time) *redis.BoolCmd

func (*LocalCache) PTTL

func (c *LocalCache) PTTL(key string) *redis.DurationCmd

func (*LocalCache) Persist

func (c *LocalCache) Persist(key string) *redis.BoolCmd

func (*LocalCache) Ping

func (c *LocalCache) Ping() *redis.StatusCmd

func (*LocalCache) Pipeline

func (c *LocalCache) Pipeline() *redis.Pipeline

func (*LocalCache) PubSubChannels

func (c *LocalCache) PubSubChannels(pattern string) *redis.StringSliceCmd

func (*LocalCache) PubSubNumPat

func (c *LocalCache) PubSubNumPat() *redis.IntCmd

func (*LocalCache) Publish

func (c *LocalCache) Publish(channel, message string) *redis.IntCmd

func (*LocalCache) RPop

func (c *LocalCache) RPop(key string) *redis.StringCmd

func (*LocalCache) RPopLPush

func (c *LocalCache) RPopLPush(source, destination string) *redis.StringCmd

func (*LocalCache) RPush

func (c *LocalCache) RPush(key string, values ...interface{}) *redis.IntCmd

func (*LocalCache) RPushX

func (c *LocalCache) RPushX(key string, value interface{}) *redis.IntCmd

func (*LocalCache) Rename

func (c *LocalCache) Rename(key, newkey string) *redis.StatusCmd

func (*LocalCache) RenameNX

func (c *LocalCache) RenameNX(key, newkey string) *redis.BoolCmd

func (*LocalCache) SAdd

func (c *LocalCache) SAdd(key string, members ...interface{}) *redis.IntCmd

func (*LocalCache) SCard

func (c *LocalCache) SCard(key string) *redis.IntCmd

func (*LocalCache) SDiff

func (c *LocalCache) SDiff(keys ...string) *redis.StringSliceCmd

func (*LocalCache) SDiffStore

func (c *LocalCache) SDiffStore(destination string, keys ...string) *redis.IntCmd

func (*LocalCache) SInter

func (c *LocalCache) SInter(keys ...string) *redis.StringSliceCmd

func (*LocalCache) SInterStore

func (c *LocalCache) SInterStore(destination string, keys ...string) *redis.IntCmd

func (*LocalCache) SIsMember

func (c *LocalCache) SIsMember(key string, member interface{}) *redis.BoolCmd

func (*LocalCache) SMembers

func (c *LocalCache) SMembers(key string) *redis.StringSliceCmd

func (*LocalCache) SMove

func (c *LocalCache) SMove(source, destination string, member interface{}) *redis.BoolCmd

func (*LocalCache) SPop

func (c *LocalCache) SPop(key string) *redis.StringCmd

func (*LocalCache) SPopN

func (c *LocalCache) SPopN(key string, count int64) *redis.StringSliceCmd

func (*LocalCache) SRandMember

func (c *LocalCache) SRandMember(key string) *redis.StringCmd

func (*LocalCache) SRandMemberN

func (c *LocalCache) SRandMemberN(key string, count int64) *redis.StringSliceCmd

func (*LocalCache) SRem

func (c *LocalCache) SRem(key string, members ...interface{}) *redis.IntCmd

func (*LocalCache) SScan

func (c *LocalCache) SScan(key string, cursor uint64, match string, count int64) redis.Scanner

func (*LocalCache) SUnion

func (c *LocalCache) SUnion(keys ...string) *redis.StringSliceCmd

func (*LocalCache) SUnionStore

func (c *LocalCache) SUnionStore(destination string, keys ...string) *redis.IntCmd

func (*LocalCache) Scan

func (c *LocalCache) Scan(cursor uint64, match string, count int64) redis.Scanner

func (*LocalCache) Set

func (c *LocalCache) Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd

func (*LocalCache) SetBit

func (c *LocalCache) SetBit(key string, offset int64, value int) *redis.IntCmd

func (*LocalCache) SetNX

func (c *LocalCache) SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd

func (*LocalCache) SetRange

func (c *LocalCache) SetRange(key string, offset int64, value string) *redis.IntCmd

func (*LocalCache) SetXX

func (c *LocalCache) SetXX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd

func (*LocalCache) Sort

func (c *LocalCache) Sort(key string, sort redis.Sort) *redis.StringSliceCmd

func (*LocalCache) StrLen

func (c *LocalCache) StrLen(key string) *redis.IntCmd

func (*LocalCache) TTL

func (c *LocalCache) TTL(key string) *redis.DurationCmd

func (*LocalCache) Type

func (c *LocalCache) Type(key string) *redis.StatusCmd

func (*LocalCache) ZAdd

func (c *LocalCache) ZAdd(key string, members ...redis.Z) *redis.IntCmd

func (*LocalCache) ZAddCh

func (c *LocalCache) ZAddCh(key string, members ...redis.Z) *redis.IntCmd

func (*LocalCache) ZAddNX

func (c *LocalCache) ZAddNX(key string, members ...redis.Z) *redis.IntCmd

func (*LocalCache) ZAddNXCh

func (c *LocalCache) ZAddNXCh(key string, members ...redis.Z) *redis.IntCmd

func (*LocalCache) ZAddXX

func (c *LocalCache) ZAddXX(key string, members ...redis.Z) *redis.IntCmd

func (*LocalCache) ZAddXXCh

func (c *LocalCache) ZAddXXCh(key string, members ...redis.Z) *redis.IntCmd

func (*LocalCache) ZCard

func (c *LocalCache) ZCard(key string) *redis.IntCmd

func (*LocalCache) ZCount

func (c *LocalCache) ZCount(key, min, max string) *redis.IntCmd

func (*LocalCache) ZIncr

func (c *LocalCache) ZIncr(key string, member redis.Z) *redis.FloatCmd

func (*LocalCache) ZIncrBy

func (c *LocalCache) ZIncrBy(key string, increment float64, member string) *redis.FloatCmd

func (*LocalCache) ZIncrNX

func (c *LocalCache) ZIncrNX(key string, member redis.Z) *redis.FloatCmd

func (*LocalCache) ZIncrXX

func (c *LocalCache) ZIncrXX(key string, member redis.Z) *redis.FloatCmd

func (*LocalCache) ZInterStore

func (c *LocalCache) ZInterStore(destination string, store redis.ZStore, keys ...string) *redis.IntCmd

func (*LocalCache) ZRange

func (c *LocalCache) ZRange(key string, start, stop int64) *redis.StringSliceCmd

func (*LocalCache) ZRangeByLex

func (c *LocalCache) ZRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*LocalCache) ZRangeByScore

func (c *LocalCache) ZRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*LocalCache) ZRangeByScoreWithScores

func (c *LocalCache) ZRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd

func (*LocalCache) ZRangeWithScores

func (c *LocalCache) ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd

func (*LocalCache) ZRank

func (c *LocalCache) ZRank(key, member string) *redis.IntCmd

func (*LocalCache) ZRem

func (c *LocalCache) ZRem(key string, members ...interface{}) *redis.IntCmd

func (*LocalCache) ZRemRangeByRank

func (c *LocalCache) ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd

func (*LocalCache) ZRemRangeByScore

func (c *LocalCache) ZRemRangeByScore(key, min, max string) *redis.IntCmd

func (*LocalCache) ZRevRange

func (c *LocalCache) ZRevRange(key string, start, stop int64) *redis.StringSliceCmd

func (*LocalCache) ZRevRangeByLex

func (c *LocalCache) ZRevRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*LocalCache) ZRevRangeByScore

func (c *LocalCache) ZRevRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*LocalCache) ZRevRangeByScoreWithScores

func (c *LocalCache) ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd

func (*LocalCache) ZRevRangeWithScores

func (c *LocalCache) ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd

func (*LocalCache) ZRevRank

func (c *LocalCache) ZRevRank(key, member string) *redis.IntCmd

func (*LocalCache) ZScan

func (c *LocalCache) ZScan(key string, cursor uint64, match string, count int64) redis.Scanner

func (*LocalCache) ZScore

func (c *LocalCache) ZScore(key, member string) *redis.FloatCmd

func (*LocalCache) ZUnionStore

func (c *LocalCache) ZUnionStore(dest string, store redis.ZStore, keys ...string) *redis.IntCmd

Jump to

Keyboard shortcuts

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