Skip to content

Commit 7c697bb

Browse files
committed
Fixed redis options
1 parent d1804af commit 7c697bb

File tree

3 files changed

+10
-167
lines changed

3 files changed

+10
-167
lines changed

options.go

-157
This file was deleted.

redis.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ var (
1818
)
1919

2020
// NewRedisStore create an instance of a redis store
21-
func NewRedisStore(opts *Options) *TokenStore {
21+
func NewRedisStore(opts *redis.Options, keyNamespace ...string) *TokenStore {
2222
if opts == nil {
2323
panic("options cannot be nil")
2424
}
25-
return NewRedisStoreWithCli(redis.NewClient(opts.redisOptions()), opts.KeyNamespace)
25+
return NewRedisStoreWithCli(redis.NewClient(opts), keyNamespace...)
2626
}
2727

2828
// NewRedisStoreWithCli create an instance of a redis store
@@ -38,11 +38,11 @@ func NewRedisStoreWithCli(cli *redis.Client, keyNamespace ...string) *TokenStore
3838
}
3939

4040
// NewRedisClusterStore create an instance of a redis cluster store
41-
func NewRedisClusterStore(opts *ClusterOptions) *TokenStore {
41+
func NewRedisClusterStore(opts *redis.ClusterOptions, keyNamespace ...string) *TokenStore {
4242
if opts == nil {
4343
panic("options cannot be nil")
4444
}
45-
return NewRedisClusterStoreWithCli(redis.NewClusterClient(opts.redisClusterOptions()), opts.KeyNamespace)
45+
return NewRedisClusterStoreWithCli(redis.NewClusterClient(opts), keyNamespace...)
4646
}
4747

4848
// NewRedisClusterStoreWithCli create an instance of a redis cluster store

redis_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55
"time"
66

7+
"github.com/go-redis/redis"
78
"gopkg.in/oauth2.v3/models"
89

910
. "github.com/smartystreets/goconvey/convey"
@@ -16,7 +17,7 @@ const (
1617

1718
func TestTokenStore(t *testing.T) {
1819
Convey("Test redis token store", t, func() {
19-
opts := &Options{
20+
opts := &redis.Options{
2021
Addr: addr,
2122
DB: db,
2223
}
@@ -104,12 +105,11 @@ func TestTokenStore(t *testing.T) {
104105

105106
func TestTokenStoreWithKeyNamespace(t *testing.T) {
106107
Convey("Test redis token store", t, func() {
107-
opts := &Options{
108-
Addr: addr,
109-
DB: db,
110-
KeyNamespace: "test:",
108+
opts := &redis.Options{
109+
Addr: addr,
110+
DB: db,
111111
}
112-
store := NewRedisStore(opts)
112+
store := NewRedisStore(opts, "test:")
113113

114114
Convey("Test authorization code store", func() {
115115
info := &models.Token{

0 commit comments

Comments
 (0)