          large_value = 'a' * (max_value_length + 1)
          try:
              cache.set('small_value', large_value)
          except Exception:
              # Some clients (e.g. pylibmc) raise when the value is too large,
              # while others (e.g. python-memcached) intentionally return True
              # indicating success. This test is primarily checking that the key
              # was deleted, so the return/exception behavior for the set()
              # itself is not important.
              pass
          # small_value should be deleted, or set if configured to accept larger values
          value = cache.get('small_value')
          self.assertTrue(value is None or value == large_value)
  
 
</s> remove         # pylibmc doesn't seem to have SERVER_MAX_VALUE_LENGTH as far as I can
        # tell from a quick check of its source code. This is falling back to
        # the default value exposed by python-memcached on my system.
        max_value_length = getattr(cache._lib, 'SERVER_MAX_VALUE_LENGTH', 1048576)
 </s> add         max_value_length = 2 ** 20 </s> remove     # Some caches -- python-memcached in particular -- need to do a cleanup at the
    # end of a request cycle. If not implemented in a particular backend
    # cache.close is a no-op
 </s> add     # Some caches need to do a cleanup at the end of a request cycle. If not
    # implemented in a particular backend cache.close() is a no-op.
            # Most clients (e.g. pymemcache or pylibmc) raise when the value is
            # too large. This test is primarily checking that the key was
            # deleted, so the return/exception behavior for the set() itself is
            # not important.
          large_value = 'a' * (max_value_length + 1)
          try:
              cache.set('small_value', large_value)
          except Exception:
            # Most clients (e.g. pymemcache or pylibmc) raise when the value is
            # too large. This test is primarily checking that the key was
            # deleted, so the return/exception behavior for the set() itself is
            # not important.
            # Most clients (e.g. pymemcache or pylibmc) raise when the value is
            # too large. This test is primarily checking that the key was
            # deleted, so the return/exception behavior for the set() itself is
            # not important.
            # Most clients (e.g. pymemcache or pylibmc) raise when the value is
            # too large. This test is primarily checking that the key was
            # deleted, so the return/exception behavior for the set() itself is
            # not important.
            # Most clients (e.g. pymemcache or pylibmc) raise when the value is
            # too large. This test is primarily checking that the key was
            # deleted, so the return/exception behavior for the set() itself is
            # not important.
            # Most clients (e.g. pymemcache or pylibmc) raise when the value is
            # too large. This test is primarily checking that the key was
            # deleted, so the return/exception behavior for the set() itself is
            # not important.
              pass
          # small_value should be deleted, or set if configured to accept larger values
          value = cache.get('small_value')
          self.assertTrue(value is None or value == large_value)
  
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 Fixed #32193 -- Deprecated MemcachedCache. 
tests/cache/tests.py