Django CacheMiddleware has a multi-threading issue with pylibmc

Django CacheMiddleware has a multi-threading issue with pylibmc.

CacheMiddleware shares a thread-unsafe cache object with many threads. It works
in most cache backends have Python implementations, but pylibmc is C
with Python bindings.

This is a simple Django project, with only django and pylibmc installed. Just
start it ./manage.py runserver with a localhost memcached and run lots of
concurrent requests: ab -n100 -c10 http://localhost:8000/

This will trigger some exceptions like: