Example #1
0
 /// <summary>
 /// Removes site from cache
 /// </summary>
 /// <param name="id"></param>
 public static void Flush(int id)
 {
     FlushCache(SiteCache.CacheKey(id));
     _siteDomains = new ConcurrentDictionary <string, int?>();
 }
Example #2
0
 /// <summary>
 /// Returns Site object from cache.  If site does not already exist in cache, it
 /// will be read and added to cache
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="rockContext">The rock context.</param>
 /// <returns></returns>
 public static SiteCache Read(int id, RockContext rockContext = null)
 {
     return(GetOrAddExisting(SiteCache.CacheKey(id),
                             () => LoadById(id, rockContext)));
 }
Example #3
0
 /// <summary>
 /// Adds Site model to cache, and returns cached object
 /// </summary>
 /// <param name="siteModel"></param>
 /// <returns></returns>
 public static SiteCache Read(Site siteModel)
 {
     return(GetOrAddExisting(SiteCache.CacheKey(siteModel.Id),
                             () => LoadByModel(siteModel)));
 }
Example #4
0
        /// <summary>
        /// Removes site from cache
        /// </summary>
        /// <param name="id"></param>
        public static void Flush(int id)
        {
            ObjectCache cache = MemoryCache.Default;

            cache.Remove(SiteCache.CacheKey(id));
        }