[EMAIL PROTECTED] wrote: > Hi, > > What about smarter cache system? I mean update not only by time-out, > but also by a DB change. > > In a news sites it will be especially usefull: content can update not > only each 'xxx' minutes, but it can also update by content > addition/edit/deletion. > > I suppose, that such system can be built in any Web system and > especially in Django. I also know that such a cache will give really > good perfomance improvement, since I realised it (using PHP) on two > sites, and one of them was quite popular news site. > > The idea is quite simple: track DB updates and time. One of the event > will occur faster and will cause to update the cache (or mark it > 'dirty' in my terminology). So, anyway, we will have site always up to > date, we will have no outdated pages (with "Today is: Tuesday, > November, 2005", when it is 2006 year already) and we will lower > regenaration frequency. > > If you will find these idea interesting, I can publish PHP > implementation and give needed comments and explanation. I just learn > Python, so I can not port it on my own right now, but I can provide > full design, so, I suppose, it can be ported and integrated easily. > > Regards, > /Alexander. > >
So some frameworks (notably ASP.net, AFAIR) take this much further, and install triggers on the database tables that message the (possibly multiple) cache system to invalidate cache entries. This is necessary with multiple webservers if you need cache coherency. I think this would be a great add-on for django.contrib - it would need thought about how the messaging works (i'm guessing a RESTful call secured by a shared secret by default), and db specific code for trigger stuff. I'm not going to implement it myself any time soon though ... ;-)
