def object_cache(key, value=None): if not value: tmp = cache.get(key) if not tmp: return None return pickle.loads(tmp) else: cache.set(key, pickle.dumps(value)) return value
def cached_query(id, data=None, timeout=None): if data is None: return view_cache.get(id) return view_cache.set(id, data, timeout=timeout)