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

Cache is cleared on every launch #5

Open
andybak opened this issue Oct 3, 2012 · 3 comments
Open

Cache is cleared on every launch #5

andybak opened this issue Oct 3, 2012 · 3 comments

Comments

@andybak
Copy link
Contributor

andybak commented Oct 3, 2012

At the end of cache.py you call clear_cache()

This means the code runs on import and therefore everytime Django starts - even for management commands.

Is this necessary? I use several frequent cron tasks that run via management commands and I'm looking to minimise the number of times I start from a cold cache.

If I can safely remove this line then my cache will spend considerably longer warm.

@yourcelf
Copy link
Owner

yourcelf commented Oct 3, 2012

Indeed, I see no reason why that line couldn't be removed.

@andybak
Copy link
Contributor Author

andybak commented Oct 15, 2012

I've thought of a slight caveat...

I've just edited some templates and restarted. I now realise I also have to reset the cache too.

So it needs to be clearly documented somewhere that a manual cache clear is needed in these situations. And probably a management command to make easy to do from the shell.

@andybak
Copy link
Contributor Author

andybak commented Oct 18, 2012

Of course - there is also the scenario when you use something like django-compress with far-future cache headers.

Normally django-compress will change the compressed filename so your compressed static files are fresh.

However - with JimmyPage you'll get the cached version of the page with the urls for the old static files.

So basically you need to increment the cache every time you change your static files. You probably also need to handle user-uploaded stuff. If you use something like django-filebrowser you'll want to listen for the file upload signal and potentially increment your cache then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants