Implemented isValidCache() completely.