/// <summary> /// Count of T in the cache. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> public static int CountOf <T>([NotNull] this IObjectStore objectStore) { // remove all objects in the cache... CodeContracts.VerifyNotNull(objectStore, "objectStore"); return(objectStore.GetAll <T>().Count()); }
/// <summary> /// Count of objects in the cache. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> public static int Count([NotNull] this IObjectStore objectStore) { // remove all objects in the cache... CodeContracts.ArgumentNotNull(objectStore, "objectStore"); return(objectStore.GetAll <object>().Count()); }
/// <summary> /// The remote all. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> /// <typeparam name="T"> /// </typeparam> public static void RemoveOf <T>([NotNull] this IObjectStore objectStore) { CodeContracts.VerifyNotNull(objectStore, "objectStore"); foreach (var i in objectStore.GetAll <T>().ToList()) { objectStore.Remove(i.Key); } }
/// <summary> /// The remote all where. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> /// <param name="whereFunc"> /// The where function. /// </param> /// <typeparam name="T"> /// </typeparam> public static void Remove( [NotNull] this IObjectStore objectStore, [NotNull] Func <string, bool> whereFunc) { CodeContracts.VerifyNotNull(objectStore, "objectStore"); CodeContracts.VerifyNotNull(whereFunc, "whereFunc"); foreach (var i in objectStore.GetAll <object>().Where(k => whereFunc(k.Key)).ToList()) { objectStore.Remove(i.Key); } }
/// <summary> /// The remote all where. /// </summary> /// <param name="objectStore"> /// The object store. /// </param> /// <param name="whereFunc"> /// The where function. /// </param> /// <typeparam name="T"> /// </typeparam> public static void RemoveOf <T>( [NotNull] this IObjectStore objectStore, [NotNull] Func <KeyValuePair <string, T>, bool> whereFunc) { CodeContracts.VerifyNotNull(objectStore, "objectStore"); CodeContracts.VerifyNotNull(whereFunc, "whereFunc"); foreach (var i in objectStore.GetAll <T>().Where(whereFunc).ToList()) { objectStore.Remove(i.Key); } }