[Opensrf-commits] r1149 - trunk/src/python/osrf

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 27 17:58:19 EST 2007


Author: erickson
Date: 2007-11-27 17:39:45 -0500 (Tue, 27 Nov 2007)
New Revision: 1149

Modified:
   trunk/src/python/osrf/cache.py
Log:
added a default timeout cache setting

Modified: trunk/src/python/osrf/cache.py
===================================================================
--- trunk/src/python/osrf/cache.py	2007-11-27 20:07:36 UTC (rev 1148)
+++ trunk/src/python/osrf/cache.py	2007-11-27 22:39:45 UTC (rev 1149)
@@ -7,6 +7,7 @@
 '''
 
 _client = None
+defaultTimeout = 0
 
 class CacheException(Exception):
     def __init__(self, info):
@@ -28,7 +29,10 @@
                 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):



More information about the opensrf-commits mailing list