﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28342	Make PyLibMCCache backend catch exceptions when memcached server is down	Julian Andrews	Joel Andrews	"If your memcached server is down, pylibmc will raise a `pylibmc.ConnectionError` or `pylibmc.ServerDown` exception for all operations. This is different from the behavior of the `python-memcached` package (see http://sendapatch.se/projects/pylibmc/misc.html). However, the `PyLibMCCache` cache backend does nothing to catch these errors. As a result, the behavior is different from the `MemcachedCache` backend which fails silently.

This behavior is particularly problematic for fragment caches which obviously shouldn't raise an exception. In any case, it seems pretty clear that both backends should have the same behavior.

----

Steps to reproduce:

1. Setup a Django app `CACHES` set to use `PyLibMCCache`:

{{{
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
        'LOCATION': '127.0.0.1:11211',
    }
}
}}}

2. With no active memcached server open a shell and run:

{{{
from django.core.cache import cache
cache.get('foo')
}}}

`pylibmc` will raise an exception. Using `MemcachedCache`, `cache.get` will instead return `None`.

"	Cleanup/optimization	closed	Core (Cache system)	3.0	Normal	needsinfo	memcached cache pylibmc		Accepted	1	0	0	0	0	0
