/// <summary>
 /// Creates a new server.
 /// </summary>
 /// <param name="host">the host</param>
 /// <param name="port">the port. If zero, an unused port is chosen automatically.</param>
 public OwinServer(IGroupCacheClient handler, int port, string host = "*")
 {
     _host    = host;
     _port    = port;
     _handler = handler;
 }
 public CircuitBreakerClient(IGroupCacheClient client, TimeSpan backOff, int maxRetry)
 {
     this._client   = client;
     this._backOff  = backOff;
     this._maxRetry = maxRetry;
 }
Exemple #3
0
        private async Task LoadFromPeerAsync(string key, Stream sink, ICacheControl cacheControl, IGroupCacheClient peerClient, CancellationToken ct)
        {
            try
            {
                Stats.TracePeerLoads(_groupName);
                using (var validatingSink = CacheEntryValidator.ValidateEntryPassThrough(key, sink))
                {
                    await peerClient.GetAsync(_groupName, key, validatingSink, cacheControl, ct).ConfigureAwait(false);

                    await validatingSink.ValidateAsync(ct).ConfigureAwait(false);
                }
            }
            catch (CircuitBreakerOpenException)
            {
                throw; // Dont log CircuitBreakerOpenException
            }
            catch (InternalServerErrorException internalErrorEx)
            {
                Logger.Error(String.Format("Call to LoadFromPeer to {0} for Cache {1} key: {2} failed on InternalServerErrorException {3}", peerClient.Endpoint.ToString(), _groupName, key, internalErrorEx.Message));
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex, String.Format("Call to LoadFromPeer to {0} for Cache {1} key: {2} failed ", peerClient.Endpoint.ToString(), _groupName, key));
                throw;
            }
        }
 public CircuitBreakerClient(IGroupCacheClient client) : this(client, TimeSpan.FromMinutes(10), 3)
 {
 }