示例#1
0
        /// <summary>
        /// Removes Lava shortcode from cache
        /// </summary>
        /// <param name="id"></param>
        public static void Flush(int id)
        {
            FlushCache(LavaShortcodeCache.CacheKey(id));
            FlushCache("Rock:LavaShortcode:All");

            // some of the cached lavatemplates might have a reference to this shortcode, so flush them all just in case
            LavaTemplateCache.Flush();
        }
示例#2
0
 /// <summary>
 /// Adds lava shortcode model to cache, and returns cached object
 /// </summary>
 /// <param name="shortcodeModel"></param>
 /// <returns></returns>
 public static LavaShortcodeCache Read(LavaShortcode shortcodeModel)
 {
     return(GetOrAddExisting(LavaShortcodeCache.CacheKey(shortcodeModel.Id),
                             () => LoadByModel(shortcodeModel)));
 }
示例#3
0
 /// <summary>
 /// Returns lava shortcode object from cache.  If lava shortcode 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 LavaShortcodeCache Read(int id, RockContext rockContext = null)
 {
     return(GetOrAddExisting(LavaShortcodeCache.CacheKey(id),
                             () => LoadById(id, rockContext)));
 }