コード例 #1
0
    def save(self, *args, **kwargs):
        # TODO: make main groups url an environment variable
        # and replace hardcoded /groups throughout site

        super(Group, self).save(*args, **kwargs)

        if self.slug:
            purge_url_from_cache('/groups/')
            purge_url_from_cache('/groups/' + self.slug + '/')
コード例 #2
0
ファイル: admin_views.py プロジェクト: amymok/cfgov-refresh
def purge(url=None):
    if url:
        purge_url_from_cache(url)
        return "flushed %s" % url
    else:
        config = settings.WAGTAILFRONTENDCACHE['akamai']
        backend = AkamaiBackend(config)
        backend.purge_all()
        return "flushed entire site"
コード例 #3
0
def invalidate_frontend_cache_for_site(sender, instance, **kwargs):
    # Purge site-specific score breakdown page
    purge_url_from_cache(reverse(instance.site))

    # Purge the leaderboard
    purge_url_from_cache(reverse('sites:index'))

    # Purge the home page because it displays a subset of the leaderboard, as well as some summary statistics.
    purge_url_from_cache('/')
コード例 #4
0
def purge_document_from_cache(instance, **kwargs):
    if not kwargs.get('created', False):
        base_url = get_base_url()
        purge_url_from_cache(
            base_url +
            reverse('wagtailapi_v1:documents:detail', args=(instance.id, )))
コード例 #5
0
def purge_page_from_cache(instance, **kwargs):
    base_url = get_base_url()
    purge_url_from_cache(
        base_url + reverse('wagtailapi_v1:pages:detail', args=(instance.id, )))
コード例 #6
0
def purge_document_from_cache(instance, **kwargs):
    if not kwargs.get('created', False):
        base_url = get_base_url()
        purge_url_from_cache(base_url + reverse('wagtailapi_v1:documents:detail', args=(instance.id, )))
コード例 #7
0
def purge_page_from_cache(instance, **kwargs):
    base_url = get_base_url()
    purge_url_from_cache(base_url + reverse('wagtailapi_v1:pages:detail', args=(instance.id, )))
コード例 #8
0
ファイル: cache.py プロジェクト: nimasmi/orch
def purge_cache_on_all_sites(path):
    if settings.DEBUG:
        return

    for site in Site.objects.all():
        purge_url_from_cache('%s%s' % (site.root_url.rstrip('/'), path))
コード例 #9
0
def purge_image_from_cache(instance, **kwargs):
    if not kwargs.get("created", False):
        base_url = get_base_url()
        purge_url_from_cache(base_url + reverse("wagtailapi_v1:images:detail", args=(instance.id,)))
コード例 #10
0
def purge_cache_on_all_sites(path):
    if settings.DEBUG:
        return

    for site in Site.objects.all():
        purge_url_from_cache('%s%s' % (site.root_url.rstrip('/'), path))
コード例 #11
0
 def handle(self, *args, **options):
     page_url = options['url']
     purge_url_from_cache(page_url)