Created
August 15, 2011 09:58
-
-
Save narfdotpl/1145983 to your computer and use it in GitHub Desktop.
invalidate Johnny Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
Thanks, had issues invalidation cache from django shell, probably because I wasn't calling
QueryCacheMiddleware()
first.