From: erickson Date: Tue, 27 Nov 2007 22:39:45 +0000 (+0000) Subject: added a default timeout cache setting X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fbd9f55f9eb0d024141053783768d58050b0fbb6;p=working%2FOpenSRF.git added a default timeout cache setting git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1149 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/python/osrf/cache.py b/src/python/osrf/cache.py index 2a8d30a..b34309d 100644 --- a/src/python/osrf/cache.py +++ b/src/python/osrf/cache.py @@ -7,6 +7,7 @@ Requires memcache: ftp://ftp.tummy.com/pub/python-memcached/ ''' _client = None +defaultTimeout = 0 class CacheException(Exception): def __init__(self, info): @@ -28,7 +29,10 @@ class CacheClient(object): raise CacheException("not connected to any memcache servers. try CacheClient.connect(servers)") self.client = _client - def put(self, key, val, timeout=0): + def put(self, key, val, timeout=None): + global defaultTimeout + if timeout is None: + timeout = defaultTimeout self.client.set(key, osrfObjectToJSON(val), timeout) def get(self, key):