Ole Gunnar Solskjaer says Edinson Cavani has learned the hard way after removing and apologising for using a racially offensive term in a social media post.