- if (cond and s.exists("production.%s" % name)) or \
- (cond and config.debug and s.exists("debug.%s" % name)):
- o = s.load(name)
+ if refresh:
+ if not config.debug and s.exists("production.%s" % name, type):
+ s.remove("production.%s" % name, type)
+ if config.debug and s.exists("debug.%s" % name, type):
+ s.remove("debug.%s" % name, type)
+
+ return if_cached_else(cond, name, function, type)
+
+def if_cached_else(cond, name, function, type=None):
+ s = SPickle()
+ if (cond and s.exists("production.%s" % name, type)) or \
+ (cond and config.debug and s.exists("debug.%s" % name, type)):
+ o = s.load(name, type)