#35166: Return python-memcached support
-------------------------------------+-------------------------------------
     Reporter:  Matej Spiller Muys   |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Core (Cache system)  |                  Version:  5.0
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:  memcached            |             Triage Stage:
  performance get_many               |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Nick Pope):

 FYI: I originally added support for `pymemcache` and suggested the
 deprecation and removal of `python-memcached` as it was unmaintained for
 years.

 I confess I was curious recently when I saw that `python-memcached` had a
 new release (v1.60) that solved many of the problems we originally had.
 Unfortunately, it also broke another workaround that Django required which
 made it inconsistent with other client libraries. I managed to get that
 fixed earlier this year and it was released as v1.62.

 I even knocked up a commit to see what it would look like to reintroduce
 this backend: https://github.com/ngnpope/django/commit/python-memcached

 It's actually very, very little. The question is - is it worth
 reintroducing given the history of poor maintenance and inconsistency? We
 wouldn't want to add this again if we're going to have to rip it out
 again, as Mariusz says... Anyway - I'm on the fence with putting this back
 in - let's say +0.1!

 If you really need to use `python-memcached>=1.62` you can write your own
 backend which is as simple as this:

 {{{#!python
 import pickle

 from django.core.cache.backends.memcached import BaseMemcachedCache


 class MemcachedCache(BaseMemcachedCache):
     """An implementation of a cache binding using python-memcached."""

     def __init__(self, server, params):
         import memcache
         super().__init__(
             server, params, library=memcache,
 value_not_found_exception=ValueError
         )
         self._options = {"pickleProtocol": pickle.HIGHEST_PROTOCOL} |
 self._options
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35166#comment:5>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d79e5bc83-999784a5-40f1-4131-813e-29bd02ac72c6-000000%40eu-central-1.amazonses.com.

Reply via email to