I am running Django (1.0.2) on Google App Engine, and would like to know which (if any) of the following Django caching modules ought to inherently work with Google’s memcache implementation:
Middlewear
-
django.middleware.cache.UpdateCacheMiddleware
-
django.middleware.common.CommonMiddleware
-
django.middleware.cache.FetchFromCacheMiddleware
Decorators
- django.views.decorators.cache.cache_page
Template fragment caching
In a template:
{{ load cache }}{% cache 500 cache_name %}...cached...{% endcache %}
Low level API
- django.core.cache
If some or all of these modules ought to work, are there any changes necessary to make them work properly, and are there any concerns or pitfalls ought one be aware of when using them?
I’ve perused the documentation and spent some time searching Google, but I haven’t seen the answer to this. I suspect it may be a “turn-key” solution, but am wary of using the Django classes without at least one reference that someone else has done it without issue.
Thank you kindly.
Running Django on Google App Engine says “it is possible to use nearly the entire Django stack on Google App Engine, including middleware.” Also, that page has an example which includes one of the classes you asked about, so at least that one ought to work:
Various sites such as this one have code for using AppEngine and the Django caching code, such as django.middleware.cache.UpdateCacheMiddleware. See this Google search for other references, of varying quality. 😉
I haven’t actually used this stuff, so I can only take others’ word for it, but it does seem as though multiple people have done it.
Edit: Django tickets 7398 and 7399 are relevant to this.