On Sun, 2007-06-17 at 20:52 -0500, Jeremy Dunck wrote: > On 6/17/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > ... > > > > Use the low-level caching API to store things like this. Write a short > > funciton that retrieves a value from the cache and regenerates it and > > stores it if it is not in the cache. No extra work required. > > > > http://www.djangoproject.com/documentation/cache/#the-low-level-cache-api > > > > This may also be useful: > http://www.djangosnippets.org/snippets/155/ > > (I'd like to see that added to core.)
Hmm... hadn't seen that before. A couple of initial impressions. (1) It has puns in both the description and the title. Somebody should be beaten for that. (2) Would be nice if it worked with any of Django's caching backends. unclear if that's possible. (3) I'm not sure the information flow isn't backwards. The current version serves second and later arrivals with the old data immediately. I can think of situations where the more natural behaviour is that everybody after the first guy waits until the information is ready. Only one "information collecting" worker is active for any particular cache key, but nobody goes home with old, smelly, past-its-use-by-date information. The data is marked as expired for a reason, after all, so why does MintCache still hand it out? If forced to guess, I would say that, on balance, the behaviour in (3) would be more useful if reversed from the current action and (2) would be nice to have. Changing (3) requires quite an implementation change, admittedly, but I'm just looking at the concept rather than the code. Worth considering, though, although I've admitted in the past to having no idea where the boundary line is for making it into contrib/. You know the drill. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---