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
0507076c
Unverified
Commit
0507076c
authored
Dec 30, 2017
by
astaxie
Committed by
GitHub
Dec 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3004 from pcallewaert/develop
redis cache: make MaxIdle configurable
parents
122414d7
59fd3952
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
redis.go
cache/redis/redis.go
+6
-1
No files found.
cache/redis/redis.go
View file @
0507076c
...
...
@@ -53,6 +53,7 @@ type Cache struct {
dbNum
int
key
string
password
string
maxIdle
int
}
// NewRedisCache create new redis cache with default collection name.
...
...
@@ -169,10 +170,14 @@ func (rc *Cache) StartAndGC(config string) error {
if
_
,
ok
:=
cf
[
"password"
];
!
ok
{
cf
[
"password"
]
=
""
}
if
_
,
ok
:=
cf
[
"maxIdle"
];
!
ok
{
cf
[
"maxIdle"
]
=
"3"
}
rc
.
key
=
cf
[
"key"
]
rc
.
conninfo
=
cf
[
"conn"
]
rc
.
dbNum
,
_
=
strconv
.
Atoi
(
cf
[
"dbNum"
])
rc
.
password
=
cf
[
"password"
]
rc
.
maxIdle
,
_
=
strconv
.
Atoi
(
cf
[
"maxIdle"
])
rc
.
connectInit
()
...
...
@@ -206,7 +211,7 @@ func (rc *Cache) connectInit() {
}
// initialize a new pool
rc
.
p
=
&
redis
.
Pool
{
MaxIdle
:
3
,
MaxIdle
:
rc
.
maxIdle
,
IdleTimeout
:
180
*
time
.
Second
,
Dial
:
dialFunc
,
}
...
...
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