﻿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
17249	cache.set() returns None, even in the case of failure	russellneufeld@…	nobody	"The set() method of class BaseMemcachedCache in django.core.cache.backends.memcached does not return the result of the call to self._cache.set().  See this code:

{{{
    def set(self, key, value, timeout=0, version=None):
        key = self.make_key(key, version=version)
        self._cache.set(key, value, self._get_memcache_timeout(timeout))
}}}

This means that all set() calls appear to work, even if memcached is down, misconfigured, timing out, etc...  It would be much better to have this call return the result of _cache.set(), since then you could tell if your set failed and do something appropriate.  This caused a very strange bug in my code, since it appeared that I couldn't read back values from memcached despite the appearance of a successful set().

I have patched my code with the following, simply adding ""return"" to the above code:

{{{
def patched_memcached_set(self, key, value, timeout=0, version=None):
    key = self.make_key(key, version=version)
    return self._cache.set(key, value, self._get_memcache_timeout(timeout))

CacheClass.set = patched_memcached_set
}}}

Would be nice to have this in the main code line though.

Thanks,

Russ"	Bug	closed	Core (Cache system)	1.3	Normal	needsinfo			Unreviewed	1	0	0	0	1	0
