<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: ormcaching</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/ormcaching.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2010-03-11T19:35:32+00:00</updated><author><name>Simon Willison</name></author><entry><title>Cache Machine: Automatic caching for your Django models</title><link href="https://simonwillison.net/2010/Mar/11/cachemachine/#atom-tag" rel="alternate"/><published>2010-03-11T19:35:32+00:00</published><updated>2010-03-11T19:35:32+00:00</updated><id>https://simonwillison.net/2010/Mar/11/cachemachine/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://jbalogh.me/2010/02/09/cache-machine/"&gt;Cache Machine: Automatic caching for your Django models&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
This is the third new ORM caching layer for Django I’ve seen in the past month! Cache Machine was developed for zamboni, the port of addons.mozilla.org to Django. Caching is enabled using a model mixin class (to hook up some post_delete hooks) and a custom caching manager. Invalidation works by maintaining a “flush list” of dependent cache entries for each object—this is currently stored in memcached and hence has potential race conditions, but a comment in the source code suggests that this could be solved by moving to redis.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/cachemachine"&gt;cachemachine&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/caching"&gt;caching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/memcached"&gt;memcached&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mozilla"&gt;mozilla&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/orm"&gt;orm&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ormcaching"&gt;ormcaching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/redis"&gt;redis&lt;/a&gt;&lt;/p&gt;



</summary><category term="cachemachine"/><category term="caching"/><category term="django"/><category term="memcached"/><category term="mozilla"/><category term="orm"/><category term="ormcaching"/><category term="python"/><category term="redis"/></entry><entry><title>Announcing django-cachebot</title><link href="https://simonwillison.net/2010/Mar/6/david/#atom-tag" rel="alternate"/><published>2010-03-06T12:48:39+00:00</published><updated>2010-03-06T12:48:39+00:00</updated><id>https://simonwillison.net/2010/Mar/6/david/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://blog.davidziegler.net/post/429237463/announcing-django-cachebot"&gt;Announcing django-cachebot&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
The ORM caching space around Django is heating up. django-cachebot is used in production at mingle.com and takes a more low level approach to cache invalidation than Johnny Cache, enabling you to specifically mark the querysets you wish to cache and providing some advanced options for cache invalidation. Unfortunately it currently relies on a patch to Django core to enable its own manager.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/cachebot"&gt;cachebot&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/caching"&gt;caching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mingle"&gt;mingle&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/orm"&gt;orm&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ormcaching"&gt;ormcaching&lt;/a&gt;&lt;/p&gt;



</summary><category term="cachebot"/><category term="caching"/><category term="django"/><category term="mingle"/><category term="orm"/><category term="ormcaching"/></entry><entry><title>Johnny Cache</title><link href="https://simonwillison.net/2010/Feb/28/johnny/#atom-tag" rel="alternate"/><published>2010-02-28T22:55:15+00:00</published><updated>2010-02-28T22:55:15+00:00</updated><id>https://simonwillison.net/2010/Feb/28/johnny/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://packages.python.org/johnny-cache/"&gt;Johnny Cache&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Clever twist on ORM-level caching for Django. Johnny Cache (great name) monkey-patches Django’s QuerySet classes and caches the result of every single SELECT query in memcached with an infinite expiry time. The cache key includes a “generation” ID for each dependent database table, and the generation is changed every single time a table is updated. For apps with infrequent writes, this strategy should work really well—but if a popular table is being updated constantly the cache will be all but useless. Impressively, the system is transaction-aware—cache entries created during a transaction are held in local memory and only pushed to memcached should the transaction complete successfully.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/caching"&gt;caching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/databases"&gt;databases&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/memcached"&gt;memcached&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/orm"&gt;orm&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ormcaching"&gt;ormcaching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/performance"&gt;performance&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;&lt;/p&gt;



</summary><category term="caching"/><category term="databases"/><category term="django"/><category term="memcached"/><category term="orm"/><category term="ormcaching"/><category term="performance"/><category term="python"/></entry><entry><title>Caching Layer for Django ORM</title><link href="https://simonwillison.net/2008/Jan/23/caching/#atom-tag" rel="alternate"/><published>2008-01-23T15:18:19+00:00</published><updated>2008-01-23T15:18:19+00:00</updated><id>https://simonwillison.net/2008/Jan/23/caching/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.davidcramer.net/code/73/caching-layer-for-django-orm.html"&gt;Caching Layer for Django ORM&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Interesting extension to Django’s ORM that adds automatic caching of querysets and smart cache invalidation.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/caching"&gt;caching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/david-cramer"&gt;david-cramer&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/orm"&gt;orm&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ormcaching"&gt;ormcaching&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;&lt;/p&gt;



</summary><category term="caching"/><category term="david-cramer"/><category term="django"/><category term="orm"/><category term="ormcaching"/><category term="python"/></entry></feed>