Follow up for #1261846-22: Document 1MB maximum size limit for cache_set() - #24
Problem/Motivation
Orig issue added a comment as a stop gap. Really though, the problem needs to be fixed.
(update this after reading orig issue more carefully. to be done by anyone.)
In a way, it would be better if the cache system handled this. Checking the size of an object or array could be really fast or really slow, depending on the PHP internals. I don't know. If slow, it would obviously be a bad idea. But if it is very fast, than it may be better to move that check into the cache system.
(especially since 1MB isn't actually a hard limit, it depends on configuration), it's to just be careful not to dump massive amounts of data into the cache and assume it'll work. If you checked the size then decided not to write to cache, that'd be worse than throwing errors since it fails silently in that case and the main issue with failing to write like this isn't the PDO exception is the cache miss every request (since usually the first thing to go is the theme registry cache which takes about one second to build).
There's a patch against Memcache to log when writes fail and include the size of the item: #435694: >1M data writes incompatible with memcached (memcached -I 32M -m32). That patch isn't ready to go in yet, but we could potentially do something with a try/catch in individual cache backends.
Proposed resolution
TBD
Remaining tasks
fill out this issue summary
User interface changes
No ui changes.
API changes
TBD.
Original report by @marvil07, @valthebald, ...
Actually, by a lot of people. Please read the orig issue: #1261846: Document 1MB maximum size limit for cache_set()