diff options
Diffstat (limited to 'memcache.py')
-rw-r--r-- | memcache.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/memcache.py b/memcache.py index 05b6657..c90af62 100644 --- a/memcache.py +++ b/memcache.py @@ -48,6 +48,7 @@ More detailed documentation is available in the L{Client} class. from __future__ import print_function import binascii +from datetime import timedelta from io import BytesIO import re import socket @@ -709,7 +710,7 @@ class Client(threading.local): expire, either as a delta number of seconds, or an absolute unix time-since-the-epoch value. See the memcached protocol docs section "Storage Commands" for more info on <exptime>. We - default to 0 == cache forever. + default to 0 == cache forever. Optionnaly now accepts a timedelta. @param min_compress_len: The threshold length to kick in auto-compression of the value using the compressor @@ -724,6 +725,8 @@ class Client(threading.local): @param noreply: optional parameter instructs the server to not send the reply. ''' + if isinstance(time, timedelta): + time = int(time.total_seconds()) return self._set("set", key, val, time, min_compress_len, noreply) def cas(self, key, val, time=0, min_compress_len=0, noreply=False): |