Revert "Issue #2370457 by AndreyMaximov: Removed excessive array exploding/concatenation in the cache functions." This reverts commit dd5aacc2.