Refactored cache types validation.