Sort cache entries