#15815: Support memcached binary protocol in PyLibMCCache
-------------------------------------+-------------------------------------
               Reporter:  mtigas     |          Owner:  nobody
                   Type:  New        |         Status:  new
  feature                            |      Component:  Core (Cache system)
              Milestone:             |       Severity:  Normal
                Version:  1.3        |       Keywords:
             Resolution:             |      Has patch:  1
           Triage Stage:  Accepted   |    Needs tests:  1
    Needs documentation:  1          |  Easy pickings:  0
Patch needs improvement:  1          |
-------------------------------------+-------------------------------------

Comment (by mtigas):

 I’ll agree with that, though I wasn’t sure how to make this semantically
 better.

 For the older cache framework, django-newcache accepted `binary` as a
 cache param (with `timeout`, `cull_frequency`, et. al.), with
 `CACHE_BEHAVIORS` as a separate settings option. (Using django-newcache as
 a comparison point since some of the newer 1.3+ cache features like
 versioning and key prefixing appear to have been based on the `newcache`
 implementation.)

 But I didn’t quite feel that special casing `PyLibMCCache` to accept a new
 base parameter was correct, either …

 {{{
 CACHES = {
     'default' : {
         "BACKEND" : 'django.core.cache.backends.memcached.PyLibMCCache',
         "LOCATION" : '127.0.0.1:11211',
         "BINARY" : True,
         "OPTIONS" : dict(tcp_nodelay=True, ketama=True),
     }
 }
 }}}

 … since the description of `OPTIONS` reads, “Any options that should be
 passed to cache backend. The list options understood by each backend vary
 with each backend. […] Cache backends backed by a third-party library will
 pass their options directly to the underlying cache library.”

 In particular, that seems to imply that for consistency’s sake, all
 implementation-specific options regarding a backend should go into
 `OPTIONS` and that it’s up to the backend to do what it needs to provide
 the correct information to the underlying library.

 Technically, a more semantically-correct option would be to do something
 like:

 {{{
 CACHES = {
     'default' : {
         "BACKEND" : 'django.core.cache.backends.memcached.PyLibMCCache',
         "LOCATION" : '127.0.0.1:11211',
         "OPTIONS" : {
             "binary": True,
             "behaviors" : dict(tcp_nodelay=True, ketama=True),
         }
     }
 }
 }}}

 Not really sure what the best patch would be at this point.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15815#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to