refactoring: simplify cache type checks