Documentation ¶
Index ¶
- Constants
- Variables
- type CacheData
- type Compressor
- type LRUCache
- func (this *LRUCache) Add(key, value interface{})
- func (this *LRUCache) CompressAndAdd(key interface{}, value []byte, compressor Compressor)
- func (this *LRUCache) Get(key interface{}) (value interface{}, ok bool)
- func (this *LRUCache) GetAndUnCompress(key interface{}) (value []byte, compressor Compressor, ok bool)
- func (this *LRUCache) Len() int
- func (this *LRUCache) Remove(key interface{})
- func (this *LRUCache) RemoveOldest()
- type RedisClient
- func (this *RedisClient) Close()
- func (this *RedisClient) DECR(key string) (int64, error)
- func (this *RedisClient) DEL(key string) error
- func (this *RedisClient) EXPIRE(key string, expireSeconds int) error
- func (this *RedisClient) GET(key string) string
- func (this *RedisClient) HDEL(key, field string) error
- func (this *RedisClient) HEXISTS(key, field string) (bool, error)
- func (this *RedisClient) HGET(key, field string) (string, error)
- func (this *RedisClient) HGETALL(key string) (map[string]string, error)
- func (this *RedisClient) HLEN(key string) (int, error)
- func (this *RedisClient) HSCAN(key string, cursor interface{}, optionArgs ...interface{}) (uint64, map[string]string, error)
- func (this *RedisClient) HSET(key, field, val string) error
- func (this *RedisClient) INCR(key string) (int64, error)
- func (this *RedisClient) SADD(key string, members ...string) (int, error)
- func (this *RedisClient) SCARD(key string) (int, error)
- func (this *RedisClient) SET(key string, val interface{}, expireSeconds int) error
- func (this *RedisClient) SUNIONSTORE(destination string, keys ...string) (int, error)
- func (this *RedisClient) ZADD(key string, score, member interface{}, optionArgs ...interface{}) error
- func (this *RedisClient) ZCARD(key string) int
- func (this *RedisClient) ZINCRBY(key string, increment, member interface{}) error
- func (this *RedisClient) ZRANGE(key string, start, stop int, withscores bool) ([]interface{}, error)
- func (this *RedisClient) ZRANK(key string, member interface{}) int
- func (this *RedisClient) ZREVRANGE(key string, start, stop int, withscores bool) ([]interface{}, error)
- func (this *RedisClient) ZREVRANK(key string, member interface{}) int
- func (this *RedisClient) ZSCAN(key string, cursor interface{}, optionArgs ...interface{}) (uint64, []interface{}, error)
- func (this *RedisClient) ZUNIONSTORE(dest string, keyNum int, keys []string, zsetArgs *ZSetArgs) error
- type ZSetArgs
Constants ¶
View Source
const ( AggregateSum = "SUM" AggregateMin = "MIN" AggregateMax = "MAX" )
View Source
const CacheKey = "cache_key"
Variables ¶
View Source
var DefaultLRUCache = NewLRUCache(defaultMaxEntryNum)
View Source
var KeyPrefix = ""
Functions ¶
This section is empty.
Types ¶
type CacheData ¶
缓存的数据格式
func NewCacheData ¶
func NewCacheData() *CacheData
func (*CacheData) UnCompress ¶
type LRUCache ¶
type LRUCache struct { Cache *lru.Cache // 可以通过它直接调用非锁定方法 // contains filtered or unexported fields }
func NewLRUCache ¶
func (*LRUCache) CompressAndAdd ¶
func (this *LRUCache) CompressAndAdd(key interface{}, value []byte, compressor Compressor)
CompressAndAdd 对数据进行 gzip 压缩之后再加入缓存中
func (*LRUCache) GetAndUnCompress ¶
func (this *LRUCache) GetAndUnCompress(key interface{}) (value []byte, compressor Compressor, ok bool)
GetAndUnCompress 获取数据并解压缩(Gunzip)
func (*LRUCache) RemoveOldest ¶
func (this *LRUCache) RemoveOldest()
type RedisClient ¶
func (*RedisClient) Close ¶
func (this *RedisClient) Close()
func (*RedisClient) DEL ¶
func (this *RedisClient) DEL(key string) error
func (*RedisClient) GET ¶
func (this *RedisClient) GET(key string) string
func (*RedisClient) HDEL ¶
func (this *RedisClient) HDEL(key, field string) error
func (*RedisClient) HGETALL ¶
func (this *RedisClient) HGETALL(key string) (map[string]string, error)
func (*RedisClient) HSET ¶
func (this *RedisClient) HSET(key, field, val string) error
func (*RedisClient) SADD ¶
func (this *RedisClient) SADD(key string, members ...string) (int, error)
func (*RedisClient) SET ¶
func (this *RedisClient) SET(key string, val interface{}, expireSeconds int) error
func (*RedisClient) SUNIONSTORE ¶
func (this *RedisClient) SUNIONSTORE(destination string, keys ...string) (int, error)
func (*RedisClient) ZADD ¶
func (this *RedisClient) ZADD(key string, score, member interface{}, optionArgs ...interface{}) error
func (*RedisClient) ZCARD ¶
func (this *RedisClient) ZCARD(key string) int
func (*RedisClient) ZINCRBY ¶
func (this *RedisClient) ZINCRBY(key string, increment, member interface{}) error
func (*RedisClient) ZRANGE ¶
func (this *RedisClient) ZRANGE(key string, start, stop int, withscores bool) ([]interface{}, error)
func (*RedisClient) ZRANK ¶
func (this *RedisClient) ZRANK(key string, member interface{}) int
func (*RedisClient) ZREVRANGE ¶
func (this *RedisClient) ZREVRANGE(key string, start, stop int, withscores bool) ([]interface{}, error)
func (*RedisClient) ZREVRANK ¶
func (this *RedisClient) ZREVRANK(key string, member interface{}) int
ZREVRANK 返回排名,-1 表示 member 不存在或错误
func (*RedisClient) ZSCAN ¶
func (this *RedisClient) ZSCAN(key string, cursor interface{}, optionArgs ...interface{}) (uint64, []interface{}, error)
func (*RedisClient) ZUNIONSTORE ¶
Click to show internal directories.
Click to hide internal directories.