From fbd9f55f9eb0d024141053783768d58050b0fbb6 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 27 Nov 2007 22:39:45 +0000 Subject: [PATCH 1/1] added a default timeout cache setting git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1149 9efc2488-bf62-4759-914b-345cdb29e865 --- src/python/osrf/cache.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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): -- 2.43.2