Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will Django's cache modules work on Google App Engine?

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.

like image 734
Brian M. Hunt Avatar asked Dec 18 '22 07:12

Brian M. Hunt


1 Answers

No, app engine provides a custom memcached API. What you'll need to do (and there may already be an open source implementation of this, I don't know), is write a Django cache backend for this API, they're pretty simple, you can use the existing memcached backend as the basis for your new one: http://code.djangoproject.com/browser/django/trunk/django/core/cache/backends/memcached.py . http://code.google.com/appengine/docs/python/memcache/usingmemcache.html shows what the App Engine memcached API looks like.

like image 85
Alex Gaynor Avatar answered Dec 28 '22 10:12

Alex Gaynor