def save_toc(toc): """ Saves the table of contents object to in-memory cache, invalidtes texts_list cache. """ scache.set_cache_elem('toc_cache', toc, 600000) scache.delete_template_cache("texts_list") scache.delete_template_cache("texts_dashboard")
def save_toc(toc): """ Saves the table of contents object to in-memory cache, invalidtes texts_list cache. """ scache.set_cache_elem('toc_cache', toc, 600000) scache.delete_template_cache("texts_list") scache.delete_template_cache("texts_dashboard") library.local_cache.pop("category_id_dict", None)
def get_toc_json(): """ Returns JSON representation of TOC. """ toc_json = scache.get_cache_elem('toc_json_cache') if toc_json: return toc_json toc = get_toc() toc_json = json.dumps(toc) scache.set_cache_elem('toc_json_cache', toc_json, 600000) return toc_json
def save_to_cache(self): pickled = pickle.dumps(self) scache.set_cache_elem('topics', pickled) scache.set_cache_elem('topics_timestamp', self.timestamp())
def save_to_cache(self): pickled = pickle.dumps(self) scache.set_cache_elem('topics', pickled, None) scache.set_cache_elem('topics_timestamp', self.timestamp(), None)