/// <summary>
 /// Gets an item from cache, and if not found, executes the itemFactory to create item and add to cache.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="itemFactory">The item factory.</param>
 /// <returns></returns>
 protected static T GetOrAddExisting(string key, Func <T> itemFactory)
 {
     return(ItemCache <T> .GetOrAddExisting(key, itemFactory));
 }
 /// <summary>
 /// Gets an item from cache, and if not found, executes the itemFactory to create item and add to cache with an expiration timespan.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="itemFactory">The item factory.</param>
 /// <param name="expiration">The expiration.</param>
 /// <returns></returns>
 protected static T GetOrAddExisting(string key, Func <T> itemFactory, TimeSpan expiration)
 {
     return(ItemCache <T> .GetOrAddExisting(key, itemFactory, expiration));
 }
 /// <summary>
 /// Returns the key prefixed with the type of object being cached.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <returns></returns>
 protected static string QualifiedKey(string key)
 {
     return(ItemCache <T> .QualifiedKey(key));
 }
 /// <summary>
 /// Gets this instance.
 /// </summary>
 /// <returns></returns>
 public static GlobalAttributesCache Get()
 {
     // NOTE this can be changed plain GetOrAddExisting once the above obsolete
     return(ItemCache <GlobalAttributesCache> .GetOrAddExisting(AllString, Load));
 }
Beispiel #5
0
 public new static GlobalAttributesCache GetOrAddExisting(string key, Func <GlobalAttributesCache> valueFactory)
 {
     // Note we still need the private method, we are just making the public method obsolete
     return(ItemCache <GlobalAttributesCache> .GetOrAddExisting(key, Load));
 }
Beispiel #6
0
 /// <summary>
 /// Removes this instance.
 /// </summary>
 public static void FlushItem(int?entityTypeId)
 {
     ItemCache <EntityTypeAttributesCache> .FlushItem(GetEntityTypeIdCacheKey( entityTypeId ));
 }
Beispiel #7
0
 public static LavaTemplateCache GetOrAddExisting(string key, Func <LavaTemplateCache> valueFactory)
 {
     return(ItemCache <LavaTemplateCache> .GetOrAddExisting(key, null));
 }