Beispiel #1
0
        /// <summary>
        /// Updates a range of <paramref name="keyValuePairs"/>.
        /// </summary>
        /// <param name="cache">The cache to use.</param>
        /// <param name="keyValuePairs">The key/value pairs that each contain the key to update and the value to update it with.</param>
        /// <param name="throwIfExpired">If set to <c>true</c>, a <see cref="KeyHasExpiredException{TKey}"/> will be thrown if the <paramref name="keyValuePairs"/> has at least one expired item key upon subscription.</param>
        /// <param name="scheduler">Scheduler to perform the update action on.</param>
        /// <returns>
        /// An observable stream that returns the updated <paramref name="keyValuePairs"/>.
        /// </returns>
        public static IObservable <KeyValuePair <TKey, TValue> > UpdateRange <TKey, TValue>(this IObservableCache <TKey, TValue> cache, IDictionary <TKey, TValue> keyValuePairs, bool throwIfExpired = true, IScheduler scheduler = null)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }
            if (keyValuePairs == null)
            {
                throw new ArgumentNullException(nameof(keyValuePairs));
            }

            return(cache.UpdateRange(Observable.Return(keyValuePairs), throwIfExpired, scheduler));
        }