/// <summary> /// Sets all. /// </summary> /// <param name="values">Values.</param> /// <param name="expiration">Expiration.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public override void BaseSetAll <T>(IDictionary <string, T> values, TimeSpan expiration) { ArgumentCheck.NotNegativeOrZero(expiration, nameof(expiration)); ArgumentCheck.NotNullAndCountGTZero(values, nameof(values)); _cache.SetAll(values, expiration); }
public void SetAll <T>(IDictionary <string, T> values, TimeSpan expiration) { if (values == null) { throw new ArgumentNullException(nameof(values)); } _cache.SetAll(values, expiration); }
/// <summary> /// Sets all. /// </summary> /// <param name="values">Values.</param> /// <param name="expiration">Expiration.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public void SetAll <T>(IDictionary <string, T> values, TimeSpan expiration) { ArgumentCheck.NotNegativeOrZero(expiration, nameof(expiration)); ArgumentCheck.NotNullAndCountGTZero(values, nameof(values)); var newDict = new Dictionary <string, T>(); foreach (var item in values) { //var valExpiration = expiration.Seconds <= 1 ? expiration : TimeSpan.FromSeconds(expiration.Seconds / 2); //var val = new CacheValue<T>(item.Value, true, valExpiration); newDict.Add(BuildCacheKey(this._name, item.Key), item.Value); } _cache.SetAll(newDict, expiration); }