Refactor CacheImpl / checkConstraint