memcached's incr and decr should throw ValueError if keys don't exist
|Reported by:||dauerbaustelle||Owned by:||anonymous|
|Component:||Core (Cache system)||Version:||1.1-beta|
|Severity:||Keywords:||memcached, cache, incr, decr, sprint200912|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The "incr" and "decr" methods of the "django.core.cache.backends.memcached.CacheClass" should throw a ValueError if the "key" to increase/decrease does not exist.
Right now, two things can happen trying to increase/decrease an invalid key, depending on the python memcached backend you're using: Using "cmemcache", you simply a
None as return value. Using "memcache", you'll get some weird ValueErrors telling you that you cannot convert "NOT_FOUND" to an int ("memcache" tries to return the memcache server's return value as int).
See the attached patch for a fix.
Change History (15)
comment:2 Changed 8 years ago by
|Component:||Uncategorized → Cache system|
|Owner:||changed from nobody to anonymous|
|Status:||new → assigned|
|Triage Stage:||Unreviewed → Accepted|
|Version:||1.0 → 1.1-beta-1|
comment:10 Changed 7 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Accepted → Ready for checkin|