EDOC-1518: cache cleanup reworked