public static async Task SendCache(this IDistributedCache cache, IConnectionManager connectionManager, string connectionId) { var keys = CacheKeys.Keys.Select(x => x).OrderBy(x => x); foreach (var key in keys) { try { var values = cache.GetCompressedBinaryObject(key); await connectionManager.SendBinaryAsync(connectionId, values, new RouteValueDictionary(new { Key = key })); } catch (Exception ex) { throw ex; } } }