コード例 #1
0
        /// <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());
        }
コード例 #2
0
        /// <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());
        }
コード例 #3
0
        /// <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);
            }
        }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
        /// <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);
            }
        }