(key string)
| 22 | var ctx = context.Background() |
| 23 | |
| 24 | func (c *RedisCache) Get(key string) (string, error) { |
| 25 | val, err := c.rdb.Get(ctx, key).Result() |
| 26 | if err == redis.Nil { |
| 27 | return "", nil |
| 28 | } |
| 29 | |
| 30 | if err != nil { |
| 31 | return "", err |
| 32 | } |
| 33 | |
| 34 | return val, nil |
| 35 | } |
| 36 | |
| 37 | func (c *RedisCache) Set(key string, value interface{}, expiration *time.Duration) error { |
| 38 | var realExpiration time.Duration |