Coupling the view with the cache system is not ideal in several ways. For example, you might want to reuse the view function in a site without cache, or you might want to publish the view to people who don't want to use them through cache. The solution to these problems is to specify the view cache in the URLconf instead of immediately next to the view functions themselves.
It's very simple to accomplish this: simply wrap a cache_page when using these view functions in URLconf. The following is the URLconf I just used: This is the previous URLconf:
urlpatterns = ('', (r'^foo/(\d{1,2})/$', my_view), )
The following is the same URLconf, but my_view is wrapped with cache_page:
from import cache_page urlpatterns = ('', (r'^foo/(\d{1,2})/$', cache_page(my_view, 60 * 15)), )
If you take this approach, don't forget to import cache_page in URLconf.