#16533 closed Bug (fixed)
pylibmc cache backend raises an exception for float timeouts
Reported by: | Jeff Balogh | Owned by: | Jeff Balogh |
---|---|---|---|
Component: | Core (Cache system) | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If the pylibmc is passed a float
timeout it crashes with TypeError: integer argument expected, got float
.
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': '0:11211', },
'memcache': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '0:11211', },
}
In [1]: from django.core.cache import get_cache
In [2]: get_cache('default').set('a', 1, 1.3) ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/jbalogh/dev/zamboni/<ipython console> in <module>()
/Users/jbalogh/dev/zamboni/vendor/src/django/django/core/cache/backends/memcached.py in set(self, key, value, timeout, version)
63 def set(self, key, value, timeout=0, version=None): 64 key = self.make_key(key, version=version)
---> 65 self._cache.set(key, value, self._get_memcache_timeout(timeout)) 66
67 def delete(self, key, version=None):
TypeError: integer argument expected, got float
In [3]: get_cache('memcache').set('a', 1, 1.3)
I don't condone this behavior but piston triggered the crash and it's a regression from memcache.py
Attachments (1)
Change History (5)
by , 13 years ago
Attachment: | float-cache-timeout.diff added |
---|
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Force timeouts to be ints in get_memcache_timeout