Opened 8 years ago

Closed 8 years ago

#20176 closed Uncategorized (duplicate)

cache.set() fails silently

Reported by: mali@… Owned by: nobody
Component: Core (Cache system) Version: 1.5
Severity: Normal Keywords:
Cc: bmispelon@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: 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: 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.
pylibmc seems to have access to the data ( but doesn't return it
db cache?

Also, is it terribly wrong to say "if your backend doesn't support success reports, we'll return None"?

Cheers, and thanks in advance.

Change History (2)

comment:1 Changed 8 years ago by mali@…

Has patch: unset

comment:2 Changed 8 years ago by Baptiste Mispelon

Cc: bmispelon@… added
Resolution: duplicate
Status: newclosed


As you noted, this issue has already been reported so there is no need to create a new ticket.

The original ticket (#17249) has been closed by a core developer 17 months ago.

If you feel strongly about this and have ideas on how to improve the situation, consider writing a proposal to the django-developers mailing list (!forum/django-developers).

Keep in mind that you will need to somehow address backwards-compatibility issues if you want to get this included.

If you get positive feedback on your ideas, feel free to reopen the original ticket.


Note: See TracTickets for help on using tickets.
Back to Top