server/sources/__init__.py
changeset 5655 ef903fff826d
parent 5557 1a534c596bff
parent 5642 6a90357b9769
child 5821 656c974961c4
--- a/server/sources/__init__.py	Tue Jun 01 17:06:41 2010 +0200
+++ b/server/sources/__init__.py	Thu Jun 03 10:17:44 2010 +0200
@@ -52,9 +52,11 @@
     return True
 
 class TimedCache(dict):
-    def __init__(self, ttlm, ttls=0):
-        # time to live in minutes
-        self.ttl = timedelta(0, ttlm*60 + ttls, 0)
+    def __init__(self, ttl):
+        # time to live in seconds
+        if ttl <= 0:
+            raise ValueError('TimedCache initialized with a ttl of %ss' % self.ttl.seconds)
+        self.ttl = timedelta(seconds=ttl)
 
     def __setitem__(self, key, value):
         dict.__setitem__(self, key, (datetime.now(), value))