Cache layer refactor