cache.set() fails silently
|Reported by:||Owned by:||nobody|
|Component:||Core (Cache system)||Version:||1.5|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
BaseMemcachedCache throws the result of its internal .set() away, so there is no feedback on whether it failed or not. I just spent day trying to figure out why my site was falling over and why the pages weren't getting cached. This is potentially deadly since it lulls you into thinking you have more capacity than you actually have.
I know this was discussed before as per: https://code.djangoproject.com/ticket/17249 but the behavior here is especially egregious. Can we at least gather thoughts on how we might handle this?
I understand why exceptions are not possible to do without breaking compat. Maybe we could have a check_success flag? Or maybe we could have a config option for cache to except? Simply returning True / False is also an option that'd be backwards compatible and backend agnostic.
I'll start enumerating backends I know in terms of returning success and maybe people can help:
python-memcached returns nonzero on success. https://github.com/linsomniac/python-memcached/blob/master/memcache.py#L563
pylibmc seems to have access to the data (https://github.com/simplegeo/pylibmc/blob/master/_pylibmcmodule.c#L289) but doesn't return it https://github.com/simplegeo/pylibmc/blob/master/pylibmc.py#L58
Also, is it terribly wrong to say "if your backend doesn't support success reports, we'll return None"?
Cheers, and thanks in advance.