Пример #1
0
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")
Пример #2
0
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")
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
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
Пример #6
0
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
Пример #7
0
 def save_to_cache(self):
     pickled = pickle.dumps(self)
     scache.set_cache_elem('topics', pickled)
     scache.set_cache_elem('topics_timestamp', self.timestamp())
Пример #8
0
 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)