/// <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(); }
/// <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))); }
/// <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))); }