Ejemplo n.º 1
0
 /// <summary>
 /// Removes the specified keys from the cache.
 ///
 /// Any keys not contained in the cache are ignored
 /// </summary>
 /// <typeparam name="TObject">The type of the object.</typeparam>
 /// <typeparam name="TKey">The type of the key.</typeparam>
 /// <param name="source">The source.</param>
 /// <param name="keys">The keys.</param>
 /// <exception cref="System.ArgumentNullException">source</exception>
 public static void Remove <TObject, TKey>(this IIntermediateCache <TObject, TKey> source, IEnumerable <TKey> keys)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     source.BatchUpdate(updater => updater.Remove(keys));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Clears all items from the cache
 /// </summary>
 /// <typeparam name="TObject">The type of the object.</typeparam>
 /// <typeparam name="TKey">The type of the key.</typeparam>
 /// <param name="source">The source.</param>
 /// <exception cref="System.ArgumentNullException">source</exception>
 public static void Clear <TObject, TKey>(this IIntermediateCache <TObject, TKey> source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     source.BatchUpdate(updater => updater.Clear());
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Populates a source into the specified cache
        /// </summary>
        /// <typeparam name="TObject">The type of the object.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <param name="source">The source.</param>
        /// <param name="detination">The detination.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">source
        /// or
        /// detination</exception>
        public static IDisposable PopulateInto <TObject, TKey>(this IObservable <IChangeSet <TObject, TKey> > source, IIntermediateCache <TObject, TKey> detination)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (detination == null)
            {
                throw new ArgumentNullException("detination");
            }

            return(source.Subscribe(changes => detination.BatchUpdate(updater => updater.Update(changes))));
        }