Declaration cache: Only keep hash of entity, and respect entity.can_cache_declaration