memcached.set_many() should not special case unicode data
|Reported by:||George Sakkis||Owned by:||nobody|
|Component:||Core (Cache system)||Version:||1.2|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
memcached.set_many() tries to be "smart" by explicitly checking for unicode values and encoding them as utf-8; that's not even a default value, it is actually hardcoded. The memcached.set() on the other hand just passes the value to the underlying memcached client. The bottom line is that the basic assumption that cache.set_many() is equivalent to calling cache.set() multiple times (but usually faster) is broken.
FWIW I was bitten by this in real-world code, it's not a theoretical problem without actual use cases.
Change History (5)
Changed 6 years ago by