public static void Set <TOuterKey, TInnerKey, TValue>( this ILocalCache <TOuterKey, TInnerKey, TValue> cache, TOuterKey outerKey, TInnerKey innerKey, TValue value, TimeSpan timeToLive) { cache.SetMany(outerKey, new[] { new KeyValuePair <TInnerKey, TValue>(innerKey, value) }, timeToLive); }
public void SetMany(ReadOnlySpan <KeyValuePair <TKey, TValue> > values, TimeSpan timeToLive) { Interlocked.Increment(ref SetManyExecutionCount); if (_throwExceptionOnNextAction) { _throwExceptionOnNextAction = false; throw new Exception(); } _innerCache.SetMany(values, timeToLive); }
public void SetMany(ReadOnlySpan <KeyValuePair <TKey, TValue> > values, TimeSpan timeToLive) { var stopwatch = StopwatchStruct.StartNew(); try { _innerCache.SetMany(values, timeToLive); OnSetManyCompletedSuccessfully(values, timeToLive, stopwatch.Elapsed); } catch (Exception ex) { OnSetManyException(values, timeToLive, stopwatch.Elapsed, ex, out var exceptionHandled); if (!exceptionHandled) { throw; } } }