Skip to content

Commit 6cea269

Browse files
committed
feat: add NewRedisStoreWithInterface
1 parent f59d69b commit 6cea269

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: redis.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,7 @@ func NewRedisStore(opts *redis.Options, keyNamespace ...string) *TokenStore {
2828

2929
// NewRedisStoreWithCli create an instance of a redis store
3030
func NewRedisStoreWithCli(cli *redis.Client, keyNamespace ...string) *TokenStore {
31-
store := &TokenStore{
32-
cli: cli,
33-
}
34-
35-
if len(keyNamespace) > 0 {
36-
store.ns = keyNamespace[0]
37-
}
38-
return store
31+
return NewRedisStoreWithInterface(cli, keyNamespace...)
3932
}
4033

4134
// NewRedisClusterStore create an instance of a redis cluster store
@@ -48,6 +41,11 @@ func NewRedisClusterStore(opts *redis.ClusterOptions, keyNamespace ...string) *T
4841

4942
// NewRedisClusterStoreWithCli create an instance of a redis cluster store
5043
func NewRedisClusterStoreWithCli(cli *redis.ClusterClient, keyNamespace ...string) *TokenStore {
44+
return NewRedisStoreWithInterface(cli, keyNamespace...)
45+
}
46+
47+
// NewRedisStoreWithInterface create an instance of a redis store
48+
func NewRedisStoreWithInterface(cli clienter, keyNamespace ...string) *TokenStore {
5149
store := &TokenStore{
5250
cli: cli,
5351
}

0 commit comments

Comments
 (0)