Ticket #11012: memcached_revert_unicode.diff

File memcached_revert_unicode.diff, 769 bytes (added by erny, 6 years ago)

don't convert from/to unicode during get/set in memcached

  • django/core/cache/backends/memcached.py

     
    2525        val = self._cache.get(smart_str(key))
    2626        if val is None:
    2727            return default
    28         else:
    29             if isinstance(val, basestring):
    30                 return smart_unicode(val)
    31             else:
    32                 return val
     28        return val
    3329
    3430    def set(self, key, value, timeout=0):
    35         if isinstance(value, unicode):
    36             value = value.encode('utf-8')
    3731        self._cache.set(smart_str(key), value, timeout or self.default_timeout)
    3832
    3933    def delete(self, key):
Back to Top