Changeset 110
- Timestamp:
- 11/09/09 18:17:33 (10 months ago)
- Files:
-
- 1 modified
-
trunk/courant/core/caching/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/courant/core/caching/models.py
r108 r110 6 6 from django_extensions.db.fields import ModificationDateTimeField 7 7 from django.conf import settings 8 9 # number of seconds to wait before fullpage cache is deleted when expiring a template fragment on that page 10 FULLPAGE_CACHE_REFRESH = 10 8 11 9 12 class CachedObject(models.Model): … … 27 30 urls.append(obj_cache.url) 28 31 29 # delete caches for all marked URLs 30 # since full-page caches don't use anti-dogpiling, we delete the caches themselves 32 # for full page caches, reset them with a short expiration time. 33 # this should hopefully allow for a non-anonymous user to load 34 # the page and create template fragment caches, so that when the 35 # first anonymous user hits the page, it doesn't have to do much 36 # processing to create a new full-page cache (since the fragments are 37 # all cached), and thus avoid potential dogpiling 31 38 for url in set(urls): 32 39 key = "%s-%s" % (settings.CACHE_KEY_PREFIX, url) 33 print "Deleting cache: %s" % key 34 cache.delete(key) 40 fullpage_cache = cache.get(key) 41 if fullpage_cache: 42 cache.set(key, fullpage_cache, FULLPAGE_CACHE_REFRESH) 35 43 except: 36 44 pass