Пример #1
0
        /// <summary>
        /// Clears the cache instance.
        /// </summary>
        public void Clear()
        {
            /* 07-29-2021 MDP
             * We want to clear the local cache immediately for this Instance of Rock.
             * Then send a CacheWasUpdatedMessage so that other Instances of Rock know that the cache was Updated.
             * This instance of Rock will also receive this CacheWasUpdatedMessage, but we already took care of that in this instance.
             * So, if we detect CacheWasUpdatedMessage is from this Instance, we can ignore it since we already took care of it.
             */

            CacheManager.Clear();
            CacheWasUpdatedMessage.Publish <T>();
        }
Пример #2
0
        /// <summary>
        /// Removes a value from the cache for the specified key and region.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="region">The region.</param>
        /// <returns></returns>
        public bool Remove(string key, string region)
        {
            /* 07-29-2021 MDP
             * We want to remove this item from local cache immediately for this Instance of Rock.
             * Then send a CacheWasUpdatedMessage so that other Instances of Rock know that the cache was Updated.
             * This instance of Rock will also receive this CacheWasUpdatedMessage, but we already took care of that in this instance.
             * So, if we detect CacheWasUpdatedMessage is from this Instance, we can ignore it since we already took care of it.
             */

            CacheManager.Remove(key, region);
            CacheWasUpdatedMessage.Publish <T>(key, region);
            return(true);
        }