Decr decrease counter in redis cache.
(key string)
| 41 | |
| 42 | // Decr decrease counter in redis cache. |
| 43 | func (ca *RedisCache) Decr(key string) (int64, error) { |
| 44 | redisClient := redisutil.GetDefaultRedisClient(ca.serverURL) |
| 45 | val, err := redisClient.DECR(key) |
| 46 | if err != nil { |
| 47 | return 0, err |
| 48 | } |
| 49 | return int64(val), nil |
| 50 | } |
| 51 | |
| 52 | // Get cache from redis cache. |
| 53 | // if non-existed or expired, return nil. |