Snippet List
This is a decorator which will gets Django to try the cache before computing the result of a function. It automatically builds the cache key as a hash of the function name and inputs, and allows you to set whatever timeout you want.
- cache
- decorator
- speed
- caching
- fast
Just put it in your python path and add it into MIDDLEWARE_CLASSES.
I know that there are a couple of snippets on this site that do something similar to this, but none of them quite suited me.
I wanted something that would indent and space the SQL so that I could differentiate it from the other output from the development server.
Also, I wanted something that would output total query execution time, which my solution does. I just hope that it's useful for someone else, too!
UPDATE: Now this should no longer get upset when running it on windows.
- sql
- middleware
- profile
- debug
- help
- console
- printing
- speed
3 snippets posted so far.