+def lastModified(name, type=None):
+ # TODO: fix for 'debug' mode also.
+ t = SPickle().mtime("production.%s" % name, type)
+ return t
+
+def cachedRecently(name, length=int(config.cachetime), type=None):
+ """
+ return true or false based on whether the modified time of the cached
+ file is within 'length' minutes.
+ """
+ if hasattr(config, 'cachecalls') and not config.cachecalls:
+ # don't use cached calls if cachecalls is false
+ return False
+
+ try:
+ t = lastModified(name, type)
+ except:
+ # file doesn't exist or we can't access it.
+ return False
+
+ current_time = time.time()
+ if current_time > t + length*60:
+ return False
+ else:
+ return True