Fix EZP-22664: View cache not cleared properly if the node count is above the threshold

Closes #938