On Tue, Nov 30, 2010 at 10:31 AM, Jacob Burch <[email protected]> wrote: > History: http://code.djangoproject.com/wiki/PylibmcSupport > Draft: https://gist.github.com/91de59e53f7f36f461ec > > Caveats/Notes: > > A) This is only the memcache.py file, changes to conf/global_settings > and core/cache/base will be needed to handle the move towards > CACHE_SETTINGS > > B) pylibmc and memcached handle negative timeouts differently. The > expected behavior as laid out in template tests is how python- > memcached handles it (instant expiration). I had to do a fairly sad > looking hack to make pylibmc work, and is noted in a comment. > > C) The current version of pylibmc doesn't play nice with python sub- > interuptors, and thus, mod_wsgi. There is a commit (https://github.com/ > lericson/pylibmc/commit/ddd2f011f73d8ccc6347c5471eff378bef58dbd5) in > trunk that fixes this, but a release has not been given out. We may > want to be extra-communicative of this and the possible workarounds. > > D) This draft has gotten minimal review due ot the holiday, so I > expect there's at least two horrifically dumb mistakes in there. > However, because I lifted a great deal from Eric Florenzano's django- > newcache, I'm going to incorrectly blame him ;)
As luck would have it, I've found exactly two points for comment (plus one can of worms) :-) Neither are horrifically dumb mistakes, though, just relatively minor issues: * The timeout handling code should be abstracted behind _get_memcache_timeout(). That utility already exists to ensure the eccentricities of memcached timeout handling are supported, and I can't see an obvious reason why we can't put this check in there too. * You've got the CACHE_SETTINGS handling happening in the cache backend itself, whereas the historical arrangement has been to handle all the settings in the backend loader, and pass them into the backend instance as arguments. Now for the can of worms -- I'm wondering if there is some potential for doing a weasel job with respect to infinite timeouts. You rectified the library to ensure that negative timeout values are turned into instant expiration, which is for consistency with the other memcache backends. However, I can't find any specific reference in Django's docs to the behavior of cache backends when timeout is negative. I'm wondering if this might be the weasel way into getting infinite timeouts -- even if it's in conjunction with a clause like "if the backend supports them". Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
