Skip to content

Instantly share code, notes, and snippets.

@alecklandgraf
Forked from narfdotpl/jc.py
Created April 25, 2013 08:51
Show Gist options
  • Save alecklandgraf/5458408 to your computer and use it in GitHub Desktop.
Save alecklandgraf/5458408 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding: utf-8
"""
Invalidate Johnny Cache's cache for given models outside "normal Django"
(e.g. in a management command).
"""
from johnny.cache import invalidate
from johnny.middleware import QueryCacheMiddleware
from stupid.models import Cheezburger, Kitten
def _main():
QueryCacheMiddleware()
invalidate(Cheezburger, Kitten)
if __name__ == '__main__':
_main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment