Issue #2370457 by AndreyMaximov: Removed excessive array exploding/concatenation in the cache functions.