Esempio n. 1
0
def reset_varnish(request, tref):
    if USE_VARNISH:
        oref = model.Ref(tref)
        if oref.is_book_level():
            invalidate_index(oref.index)
            invalidate_counts(oref.index)
        invalidate_ref(oref)
        return HttpResponseRedirect("/?m=Varnish-Reset-For-{}".format(oref.url()))
    return HttpResponseRedirect("/?m=Varnish-Not-Enabled")
Esempio n. 2
0
def process_index_change_in_cache(indx, **kwargs):
    """_args = ('make_toc_html', kwargs["old"])
    kw_args = {'zoom': 1}
    key = cache_get_key(_args, kw_args)
    delete_cache_elem(key)"""
    reset_texts_cache()
    if USE_VARNISH:
        from sefaria.system.sf_varnish import invalidate_index
        invalidate_index(indx)
Esempio n. 3
0
def reset_ref(request, tref):
    """
    resets cache, versionstate, toc, varnish, & book TOC template
    :param tref:
    :return:
    """
    oref = model.Ref(tref)
    if oref.is_book_level():
        model.library.refresh_index_record_in_cache(oref.index)
        vs = model.VersionState(index=oref.index)
        vs.refresh()
        model.library.update_index_in_toc(oref.index)
        scache.delete_cache_elem(scache.generate_text_toc_cache_key(oref.index.title))
        if USE_VARNISH:
            invalidate_index(oref.index)
            invalidate_counts(oref.index)
            invalidate_ref(oref)
        return HttpResponseRedirect("/{}?m=Reset-Index".format(oref.url()))
    elif USE_VARNISH:
        invalidate_ref(oref)
        return HttpResponseRedirect("/{}?m=Reset-Ref".format(oref.url()))
    else:
        return HttpResponseRedirect("/?m=Nothing-to-Reset")
Esempio n. 4
0
def reset_index_cache_for_text(request, title):
    scache.set_index(title, None)
    if USE_VARNISH:
        invalidate_index(title)
    return HttpResponseRedirect("/%s?m=Cache-Reset" % title)
Esempio n. 5
0
def process_index_delete_in_cache(indx, **kwargs):
    reset_texts_cache()
    if USE_VARNISH:
        from sefaria.system.sf_varnish import invalidate_index, invalidate_counts
        invalidate_index(indx.title)
        invalidate_counts(indx.title)
Esempio n. 6
0
def process_index_change_in_cache(indx, **kwargs):
    reset_texts_cache()
    if USE_VARNISH:
        from sefaria.system.sf_varnish import invalidate_index
        invalidate_index(indx)