public void Set(TKey key, TValue value, TimeSpan timeToLive) { Interlocked.Increment(ref SetExecutionCount); if (_throwExceptionOnNextAction) { _throwExceptionOnNextAction = false; throw new Exception(); } _innerCache.Set(key, value, timeToLive); }
public void Set(TKey key, TValue value, TimeSpan timeToLive) { var stopwatch = StopwatchStruct.StartNew(); try { _innerCache.Set(key, value, timeToLive); OnSetCompletedSuccessfully(key, value, timeToLive, stopwatch.Elapsed); } catch (Exception ex) { OnSetException(key, value, timeToLive, stopwatch.Elapsed, ex, out var exceptionHandled); if (!exceptionHandled) { throw; } } }