Skip to content

Commit

Permalink
feat(redis): add redis client interface, for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
id committed May 19, 2020
1 parent 9272b36 commit d9b2608
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type SyncCacheOpts struct {
}

type SyncCacheClient struct {
redis *redis.Client
redis Redis
cacheGroupManager *CacheGroupsManager
}

Expand Down
13 changes: 13 additions & 0 deletions redis_interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package sync_cache

import (
"github.com/go-redis/redis"
"time"
)

type Redis interface {
Get(key string) *redis.StringCmd
Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
Del(keys ...string) *redis.IntCmd
FlushDB() *redis.StatusCmd
}

0 comments on commit d9b2608

Please sign in to comment.