Documentation ¶
Index ¶
- Variables
- type RedisCache
- func (ca *RedisCache) ClearAll() error
- func (ca *RedisCache) Decr(key string) (int64, error)
- func (ca *RedisCache) Delete(key string) error
- func (ca *RedisCache) Exists(key string) (bool, error)
- func (ca *RedisCache) Get(key string) (interface{}, error)
- func (ca *RedisCache) GetInt(key string) (int, error)
- func (ca *RedisCache) GetInt64(key string) (int64, error)
- func (ca *RedisCache) GetString(key string) (string, error)
- func (ca *RedisCache) Incr(key string) (int64, error)
- func (ca *RedisCache) Set(key string, value interface{}, ttl int64) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ZeroInt64 int64 = 0
)
Functions ¶
This section is empty.
Types ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache is redis cache adapter. it contains serverIp for redis conn.
func NewRedisCache ¶
func NewRedisCache(serverURL string) *RedisCache
NewRedisCache returns a new *RedisCache.
func (*RedisCache) ClearAll ¶
func (ca *RedisCache) ClearAll() error
ClearAll will delete all item in redis cache. never error
func (*RedisCache) Decr ¶
func (ca *RedisCache) Decr(key string) (int64, error)
Decr decrease counter in redis cache.
func (*RedisCache) Delete ¶
func (ca *RedisCache) Delete(key string) error
Delete item in redis cacha. if not exists, we think it's success
func (*RedisCache) Exists ¶
func (ca *RedisCache) Exists(key string) (bool, error)
Exists check item exist in redis cache.
func (*RedisCache) Get ¶
func (ca *RedisCache) Get(key string) (interface{}, error)
Get cache from redis cache. if non-existed or expired, return nil.
func (*RedisCache) GetInt ¶
func (ca *RedisCache) GetInt(key string) (int, error)
returns value int format by given key
if non-existed or expired, return nil.
func (*RedisCache) GetInt64 ¶
func (ca *RedisCache) GetInt64(key string) (int64, error)
returns value int64 format by given key
if non-existed or expired, return nil.
func (*RedisCache) GetString ¶
func (ca *RedisCache) GetString(key string) (string, error)
returns value string format by given key
if non-existed or expired, return "".
Click to show internal directories.
Click to hide internal directories.