Refactor chain cache