Skip to content

Commit b3a9840

Browse files
Added Del in Redis module
1 parent 789b498 commit b3a9840

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/redis/redis.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
type RedisClient interface {
1313
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
1414
Get(ctx context.Context, key string) (string, error)
15+
Del(ctx context.Context, keys ...string) *redis.IntCmd
1516
HSet(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
1617
RPush(ctx context.Context, key string, value interface{}) *redis.IntCmd
1718
LRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd
@@ -50,6 +51,11 @@ func (r *redisClient) Get(ctx context.Context, key string) (string, error) {
5051
return r.client.Get(ctx, key).Result()
5152
}
5253

54+
/* deletes a redis entry */
55+
func (r *redisClient) Del(ctx context.Context, keys ...string) *redis.IntCmd {
56+
return r.client.Del(ctx, keys...)
57+
}
58+
5359
/* for pushing multiple elements in Redis */
5460
func (r *redisClient) RPush(ctx context.Context, key string, value interface{}) *redis.IntCmd {
5561
return r.client.RPush(ctx, key, value)

0 commit comments

Comments
 (0)