Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1fb4e8de
Commit
1fb4e8de
authored
Aug 03, 2010
by
antirez
Browse files
PERSIST: a fix and some basic test
parent
a539d29a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
1fb4e8de
...
@@ -532,9 +532,11 @@ void persistCommand(redisClient *c) {
...
@@ -532,9 +532,11 @@ void persistCommand(redisClient *c) {
if
(
de
==
NULL
)
{
if
(
de
==
NULL
)
{
addReply
(
c
,
shared
.
czero
);
addReply
(
c
,
shared
.
czero
);
}
else
{
}
else
{
if
(
removeExpire
(
c
->
db
,
c
->
argv
[
1
]))
if
(
removeExpire
(
c
->
db
,
c
->
argv
[
1
]))
{
addReply
(
c
,
shared
.
cone
);
addReply
(
c
,
shared
.
cone
);
else
server
.
dirty
++
;
}
else
{
addReply
(
c
,
shared
.
czero
);
addReply
(
c
,
shared
.
czero
);
}
}
}
}
}
tests/unit/expire.tcl
View file @
1fb4e8de
...
@@ -60,4 +60,15 @@ start_server {tags {"expire"}} {
...
@@ -60,4 +60,15 @@ start_server {tags {"expire"}} {
catch
{
r setex z -10 foo
}
e
catch
{
r setex z -10 foo
}
e
set _ $e
set _ $e
}
{
*invalid expire*
}
}
{
*invalid expire*
}
test
{
PERSIST can undo an EXPIRE
}
{
r set x foo
r expire x 50
list
[
r ttl x
]
[
r persist x
]
[
r ttl x
]
[
r get x
]
}
{
50 1 -1 foo
}
test
{
PERSIST returns 0 against non existing or non volatile keys
}
{
r set x foo
list
[
r persist foo
]
[
r persist nokeyatall
]
}
{
0 0
}
}
}
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