Django users,

Is there an easy way to enable an automatic write-through
database cache in Django?

I'd want memcached or something to cache all data read by the
Django ORM and use the cached copy on future reads, and of
course update the cache as well as the DB (a "write-through"
cache) when writing data.

Is there a piece of middleware I can activate to cause the ORM
to do this automatically for all DB queries?  Thanks!

Details:

I'm interested in caching the results of queries to the DB, not
caching the results of templates or views.  So, it is different
from the following, which I already know how to do:
- Caching of template files:
   - http://us5.campaign-archive1.com/?u=a8d4be66d1927077a9255182d&id=a6f7d644a7&e=c90970e145
   - https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader
- Caching of all Django views for an entire site:
   - https://docs.djangoproject.com/en/dev/topics/cache/#the-per-site-cache
- Caching of specific Django views:
  - https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache
- Caching of fragments of a Django Template:
  - https://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching

I'm also hoping to not have to add cache API calls throughout my
code, as described here:
- https://docs.djangoproject.com/en/dev/topics/cache/#the-low-level-cache-api

I'd like the Django ORM to make the API calls for me automatically
when I call objects.get(), objects.filter(), save(), etc.  I'd hoped to
enable it simply by adding middleware or a custom manager or
something.

Any suggestions?  I feel like I may be missing something obvious.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/054667d7-381c-9783-a959-626d72574537%40bristle.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to