Example #1
0
File: box.py Project: joskid/ella
 def render(self):
     " Cached wrapper around self._render(). "
     if getattr(settings, 'DOUBLE_RENDER', False) and self.can_double_render:
         if 'SECOND_RENDER' not in self._context:
             return self.double_render()
     key = self.get_cache_key()
     rend = cache.get(key)
     if rend is None:
         rend = self._render()
         cache.set(key, rend, core_settings.CACHE_TIMEOUT)
         for model, test in self.get_cache_tests():
             CACHE_DELETER.register_test(model, test, key)
         CACHE_DELETER.register_pk(self.obj, key)
     return rend
Example #2
0
File: box.py Project: whit/ella
 def render(self):
     " Cached wrapper around self._render(). "
     if getattr(settings, 'DOUBLE_RENDER',
                False) and self.can_double_render:
         if 'SECOND_RENDER' not in self._context:
             return self.double_render()
     key = self.get_cache_key()
     rend = cache.get(key)
     if rend is None:
         rend = self._render()
         cache.set(key, rend, core_settings.CACHE_TIMEOUT)
         for model, test in self.get_cache_tests():
             CACHE_DELETER.register_test(model, test, key)
         CACHE_DELETER.register_pk(self.obj, key)
     return rend
Example #3
0
def invalidate_listing(key, self, *args, **kwargs):
    CACHE_DELETER.register_test(self.model, '', key)
Example #4
0
def invalidate_cache(key, template_name, template_dirs=None):
    from ella.db_templates.models import DbTemplate
    if DbTemplate._meta.installed:
        CACHE_DELETER.register_test(DbTemplate, "name:%s" % template_name, key)
Example #5
0
def invalidate_cache(key, template_name, template_dirs=None):
    from ella.db_templates.models import DbTemplate

    if DbTemplate._meta.installed:
        CACHE_DELETER.register_test(DbTemplate, "name:%s" % template_name, key)
Example #6
0
def invalidate_listing(key, self, *args, **kwargs):
    CACHE_DELETER.register_test(self.model, '', key)
Example #7
0
def gallery_cache_invalidator(key, gallery, *args, **kwargs):
    """Registers gallery cache invalidator test in the cache system."""
    CACHE_DELETER.register_pk(gallery, key)
    CACHE_DELETER.register_test(GalleryItem, 'gallery_id:%s' % gallery.pk, key)
Example #8
0
def invalidate_cache(key,  self, object, **kwargs):
    target_ct = ContentType.objects.get_for_model(object)
    CACHE_DELETER.register_test(Comment, "target_id:%s;target_ct_id:%s" % (object.pk, target_ct.pk) , key)
Example #9
0
def gallery_cache_invalidator(key, gallery, *args, **kwargs):
    """Registers gallery cache invalidator test in the cache system."""
    CACHE_DELETER.register_pk(gallery, key)
    CACHE_DELETER.register_test(GalleryItem, 'gallery_id:%s' % gallery.pk, key)
Example #10
0
def invalidate_cache(key,  self, object, **kwargs):
    target_ct = ContentType.objects.get_for_model(object)
    CACHE_DELETER.register_test(Comment, "target_id:%s;target_ct_id:%s" % (object.pk, target_ct.pk) , key)