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
0caadb9b
Commit
0caadb9b
authored
Mar 07, 2016
by
liuchun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename vars
parent
22e39004
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
.travis.yml
.travis.yml
+0
-1
ssdb.go
cache/ssdb/ssdb.go
+13
-13
No files found.
.travis.yml
View file @
0caadb9b
...
...
@@ -10,7 +10,6 @@ services:
-
mysql
-
postgresql
-
memcached
-
ssdb
env
:
-
ORM_DRIVER=sqlite3 ORM_SOURCE=$TRAVIS_BUILD_DIR/orm_test.db
-
ORM_DRIVER=mysql ORM_SOURCE="root:@/orm_test?charset=utf8"
...
...
cache/ssdb/ssdb.go
View file @
0caadb9b
...
...
@@ -50,9 +50,9 @@ func (rc *Cache) GetMulti(keys []string) []interface{} {
}
}
res
,
err
:=
rc
.
conn
.
Do
(
"multi_get"
,
keys
)
res
_s
ize
:=
len
(
res
)
res
S
ize
:=
len
(
res
)
if
err
==
nil
{
for
i
:=
1
;
i
<
res
_s
ize
;
i
+=
2
{
for
i
:=
1
;
i
<
res
S
ize
;
i
+=
2
{
values
=
append
(
values
,
string
(
res
[
i
+
1
]))
}
return
values
...
...
@@ -154,9 +154,9 @@ func (rc *Cache) IsExist(key string) bool {
}
if
resp
[
1
]
==
"1"
{
return
true
}
else
{
return
false
}
return
false
}
// ClearAll clear all cached in memcache.
...
...
@@ -166,8 +166,8 @@ func (rc *Cache) ClearAll() error {
return
err
}
}
key
_start
,
key_e
nd
,
limit
:=
""
,
""
,
50
resp
,
err
:=
rc
.
Scan
(
key
_start
,
key_e
nd
,
limit
)
key
Start
,
keyE
nd
,
limit
:=
""
,
""
,
50
resp
,
err
:=
rc
.
Scan
(
key
Start
,
keyE
nd
,
limit
)
for
err
==
nil
{
size
:=
len
(
resp
)
if
size
==
1
{
...
...
@@ -181,20 +181,20 @@ func (rc *Cache) ClearAll() error {
if
e
!=
nil
{
return
e
}
key
_s
tart
=
resp
[
size
-
2
]
resp
,
err
=
rc
.
Scan
(
key
_start
,
key_e
nd
,
limit
)
key
S
tart
=
resp
[
size
-
2
]
resp
,
err
=
rc
.
Scan
(
key
Start
,
keyE
nd
,
limit
)
}
return
err
}
// Scan key all cached in ssdb.
func
(
rc
*
Cache
)
Scan
(
key
_start
string
,
key_e
nd
string
,
limit
int
)
([]
string
,
error
)
{
func
(
rc
*
Cache
)
Scan
(
key
Start
string
,
keyE
nd
string
,
limit
int
)
([]
string
,
error
)
{
if
rc
.
conn
==
nil
{
if
err
:=
rc
.
connectInit
();
err
!=
nil
{
return
nil
,
err
}
}
resp
,
err
:=
rc
.
conn
.
Do
(
"scan"
,
key
_start
,
key_e
nd
,
limit
)
resp
,
err
:=
rc
.
conn
.
Do
(
"scan"
,
key
Start
,
keyE
nd
,
limit
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -221,9 +221,9 @@ func (rc *Cache) StartAndGC(config string) error {
// connect to memcache and keep the connection.
func
(
rc
*
Cache
)
connectInit
()
error
{
conninfo
_a
rray
:=
strings
.
Split
(
rc
.
conninfo
[
0
],
":"
)
host
:=
conninfo
_a
rray
[
0
]
port
,
e
:=
strconv
.
Atoi
(
conninfo
_a
rray
[
1
])
conninfo
A
rray
:=
strings
.
Split
(
rc
.
conninfo
[
0
],
":"
)
host
:=
conninfo
A
rray
[
0
]
port
,
e
:=
strconv
.
Atoi
(
conninfo
A
rray
[
1
])
if
e
!=
nil
{
return
e
}
...
...
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