Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
886fefe7
Commit
886fefe7
authored
Mar 26, 2018
by
godcong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change github.com/garyburd/redigo to newest branch github.com/gomodule/redigo
parent
f1668881
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
31 deletions
+34
-31
.travis.yml
.travis.yml
+1
-1
README.md
cache/README.md
+1
-1
redis.go
cache/redis/redis.go
+3
-3
redis_test.go
cache/redis/redis_test.go
+1
-1
sess_redis.go
session/redis/sess_redis.go
+28
-25
No files found.
.travis.yml
View file @
886fefe7
...
...
@@ -22,7 +22,7 @@ install:
-
go get github.com/go-sql-driver/mysql
-
go get github.com/mattn/go-sqlite3
-
go get github.com/bradfitz/gomemcache/memcache
-
go get github.com/g
aryburd
/redigo/redis
-
go get github.com/g
omodule
/redigo/redis
-
go get github.com/beego/x2j
-
go get github.com/couchbase/go-couchbase
-
go get github.com/beego/goyaml2
...
...
cache/README.md
View file @
886fefe7
...
...
@@ -52,7 +52,7 @@ Configure like this:
## Redis adapter
Redis adapter use the
[
redigo
](
http://github.com/g
aryburd
/redigo
)
client.
Redis adapter use the
[
redigo
](
http://github.com/g
omodule
/redigo
)
client.
Configure like this:
...
...
cache/redis/redis.go
View file @
886fefe7
...
...
@@ -14,9 +14,9 @@
// Package redis for cache provider
//
// depend on github.com/g
aryburd
/redigo/redis
// depend on github.com/g
omodule
/redigo/redis
//
// go install github.com/g
aryburd
/redigo/redis
// go install github.com/g
omodule
/redigo/redis
//
// Usage:
// import(
...
...
@@ -36,7 +36,7 @@ import (
"strconv"
"time"
"github.com/g
aryburd
/redigo/redis"
"github.com/g
omodule
/redigo/redis"
"github.com/astaxie/beego/cache"
)
...
...
cache/redis/redis_test.go
View file @
886fefe7
...
...
@@ -19,7 +19,7 @@ import (
"time"
"github.com/astaxie/beego/cache"
"github.com/g
aryburd
/redigo/redis"
"github.com/g
omodule
/redigo/redis"
)
func
TestRedisCache
(
t
*
testing
.
T
)
{
...
...
session/redis/sess_redis.go
View file @
886fefe7
...
...
@@ -14,9 +14,9 @@
// Package redis for session provider
//
// depend on github.com/g
aryburd
/redigo/redis
// depend on github.com/g
omodule
/redigo/redis
//
// go install github.com/g
aryburd
/redigo/redis
// go install github.com/g
omodule
/redigo/redis
//
// Usage:
// import(
...
...
@@ -24,10 +24,10 @@
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``)
// go globalSessions.GC()
// }
//
func init() {
//
globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``)
//
go globalSessions.GC()
//
}
//
// more docs: http://beego.me/docs/module/session.md
package
redis
...
...
@@ -40,7 +40,7 @@ import (
"github.com/astaxie/beego/session"
"github.com/g
aryburd
/redigo/redis"
"github.com/g
omodule
/redigo/redis"
)
var
redispder
=
&
Provider
{}
...
...
@@ -149,27 +149,30 @@ func (rp *Provider) SessionInit(maxlifetime int64, savePath string) error {
}
else
{
rp
.
dbNum
=
0
}
rp
.
poollist
=
redis
.
NewPool
(
func
()
(
redis
.
Conn
,
error
)
{
c
,
err
:=
redis
.
Dial
(
"tcp"
,
rp
.
savePath
)
if
err
!=
nil
{
return
nil
,
err
}
if
rp
.
password
!=
""
{
if
_
,
err
=
c
.
Do
(
"AUTH"
,
rp
.
password
);
err
!=
nil
{
c
.
Close
()
return
nil
,
err
}
}
//some redis proxy such as twemproxy is not support select command
if
rp
.
dbNum
>
0
{
_
,
err
=
c
.
Do
(
"SELECT"
,
rp
.
dbNum
)
rp
.
poollist
=
&
redis
.
Pool
{
Dial
:
func
()
(
redis
.
Conn
,
error
)
{
c
,
err
:=
redis
.
Dial
(
"tcp"
,
rp
.
savePath
)
if
err
!=
nil
{
c
.
Close
()
return
nil
,
err
}
}
return
c
,
err
},
rp
.
poolsize
)
if
rp
.
password
!=
""
{
if
_
,
err
=
c
.
Do
(
"AUTH"
,
rp
.
password
);
err
!=
nil
{
c
.
Close
()
return
nil
,
err
}
}
// some redis proxy such as twemproxy is not support select command
if
rp
.
dbNum
>
0
{
_
,
err
=
c
.
Do
(
"SELECT"
,
rp
.
dbNum
)
if
err
!=
nil
{
c
.
Close
()
return
nil
,
err
}
}
return
c
,
err
},
MaxIdle
:
rp
.
poolsize
,
}
return
rp
.
poollist
.
Get
()
.
Err
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment