Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about enabling CACHE by default? #65

Open
qris opened this issue Jun 23, 2014 · 1 comment
Open

How about enabling CACHE by default? #65

qris opened this issue Jun 23, 2014 · 1 comment

Comments

@qris
Copy link
Collaborator

qris commented Jun 23, 2014

MIDDLEWARE_CLASSES = (
    'django.middleware.cache.UpdateCacheMiddleware',
    ...
    'django.middleware.cache.FetchFromCacheMiddleware',
)

# turn on general caching, but not for logged in users
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
        'LOCATION': 'cache',
    }
}

# test stuff
import sys
if 'test' in sys.argv:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        }
    }

CMS_CACHE_DURATIONS = {
    'content': 60,
    'menus': 600,
}
@qris
Copy link
Collaborator Author

qris commented Jun 30, 2014

Enabling the Cache caused a bug to show up in Washwatch: serialising the results of rendering a PDF using Pickle failed, because it tries to serialise a Hashlib object for some reason. Pickle makes this impossible to debug. Points to note:

  • The site was not obviously broken until we tried to access the PDF download link
  • Having caching enabled from the beginning would have allowed us to spot this quickly.
  • Caching makes an enormous difference to site performance.
  • We might want a custom cache module that serialises using JSON instead of Pickle, so that the cache is (a) human-readable and (b) debuggable (Pickle is horrendous in this regard).

@decentral1se decentral1se added this to the P2: SHOULD milestone Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants