Ejemplo n.º 1
0
        /// <summary>
        /// Removes the specified cache index.
        /// </summary>
        /// <param name="cacheIndex">Index of the cache.</param>
        public static void Remove(CacheIndex cacheIndex)
        {
            if (cacheIndex == null)
            {
                throw new ArgumentNullException("cacheIndex", "Requested CacheIndex is null");
            }

            string key = CacheIndexMap.GetKey(cacheIndex);

            CacheIndexMap.Remove(key);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the specified cache index.
        /// </summary>
        /// <param name="cacheIndex">Index of the cache.</param>
        public static void Update(CacheIndex cacheIndex)
        {
            if (cacheIndex == null)
            {
                throw new ArgumentNullException("cacheIndex");
            }

            string key = CacheIndexMap.GetKey(cacheIndex);

            // if the key exists in the map then replace it with current parameter..
            if (Map.ContainsKey(key))
            {
                CacheIndexMap.Remove(key);
            }

            CacheIndexMap.Add(cacheIndex);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the specified cache index.
        /// </summary>
        /// <param name="cacheIndex">The cache index to add to the map.</param>
        public static void Add(CacheIndex cacheIndex)
        {
            if (cacheIndex == null)
            {
                throw new ArgumentNullException("cacheIndex");
            }

            string key = CacheIndexMap.GetKey(cacheIndex);

            lock (Map)
            {
                // if the cacheIndex key doesn't already exist in the map then add it.
                if (!Map.ContainsKey(key))
                {
                    Map.Add(key, cacheIndex);
                }
            }
        }