Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: add NewRedisStoreWithInterface
  • Loading branch information
Nomango committed Nov 16, 2023
commit 6cea26956efef627be0cdb469bbdedb94fe120e3
14 changes: 6 additions & 8 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ func NewRedisStore(opts *redis.Options, keyNamespace ...string) *TokenStore {

// NewRedisStoreWithCli create an instance of a redis store
func NewRedisStoreWithCli(cli *redis.Client, keyNamespace ...string) *TokenStore {
store := &TokenStore{
cli: cli,
}

if len(keyNamespace) > 0 {
store.ns = keyNamespace[0]
}
return store
return NewRedisStoreWithInterface(cli, keyNamespace...)
}

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

// NewRedisClusterStoreWithCli create an instance of a redis cluster store
func NewRedisClusterStoreWithCli(cli *redis.ClusterClient, keyNamespace ...string) *TokenStore {
return NewRedisStoreWithInterface(cli, keyNamespace...)
}

// NewRedisStoreWithInterface create an instance of a redis store
func NewRedisStoreWithInterface(cli clienter, keyNamespace ...string) *TokenStore {
store := &TokenStore{
cli: cli,
}
Expand Down