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
ab48d029
"vscode:/vscode.git/clone" did not exist on "3213e8de921ef55896f740fb55e9469bbe2a22c4"
Commit
ab48d029
authored
Apr 06, 2009
by
Ludovico Magnocavallo
Browse files
add expire command to the python lib
parent
bb32ede5
Changes
1
Hide whitespace changes
Inline
Side-by-side
client-libraries/python/redis.py
View file @
ab48d029
...
...
@@ -231,13 +231,20 @@ class Redis(object):
self
.
_write
(
'DEL %s
\r\n
'
%
name
)
return
self
.
get_response
()
def
key
_type
(
self
,
name
):
def
get
_type
(
self
,
name
):
"""
Not yet implemented.
>>> r = Redis(db=9)
>>> r.set('a', 3)
'OK'
>>> r.get_type('a')
'string'
>>> r.get_type('zzz')
>>>
"""
self
.
connect
()
self
.
_write
(
'TYPE %s
\r\n
'
%
name
)
return
self
.
get_response
()
res
=
self
.
get_response
()
return
None
if
res
==
'none'
else
res
def
keys
(
self
,
pattern
):
"""
...
...
@@ -304,6 +311,21 @@ class Redis(object):
else
:
self
.
_write
(
'RENAME %s %s
\r\n
'
%
(
src
,
dst
))
return
self
.
get_response
()
#.strip()
def
expire
(
self
,
name
,
time
):
"""
>>> r = Redis(db=9)
>>> r.set('a', 1)
'OK'
>>> r.expire('a', 1)
1
>>> r.expire('zzzzz', 1)
0
>>>
"""
self
.
connect
()
self
.
_write
(
'EXPIRE %s %s
\r\n
'
%
(
name
,
time
))
return
self
.
get_response
()
def
push
(
self
,
name
,
value
,
tail
=
False
):
"""
...
...
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