Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all.
We are caching redirect urls and are trying to convert our code from Umbraco 8 to Umbraco 9 and are missing the good old CacheItemRemovedCallback from System.Web.Caching.
In Umbraco 8 we used Umbraco.Core.Cache.AppCacheExtensions:
public static void InsertCacheItem<T>(this IAppPolicyCache provider, string cacheKey, Func<T> getCacheItem, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null);
Like this:
protected void InsertIntoCache(object item) { appCaches.RuntimeCache.InsertCacheItem("customKey", () => item, null, false, CacheItemPriority.Normal, new CacheItemRemovedCallback(CachedItemRemovedCallback), new string[] { "D:\\root\\web\\app_data\\somefile.txt" }); } protected void CachedItemRemovedCallback(string key, object val, CacheItemRemovedReason reason) { if (key.Contains(Key)) { var item = Get(); // Some function to get item for Cache. InsertIntoCache(item); } }
In Umbraco 9 there is no CachedItemRemovedCallback in Umbraco.Extensions.AppCacheExtensions:
public static void InsertCacheItem<T>(this IAppPolicyCache provider, string cacheKey, Func<T> getCacheItem, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null)
So how do we setup something similar in Umbraco 9?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Cache with dependecy file
Hi all.
We are caching redirect urls and are trying to convert our code from Umbraco 8 to Umbraco 9 and are missing the good old CacheItemRemovedCallback from System.Web.Caching.
In Umbraco 8 we used Umbraco.Core.Cache.AppCacheExtensions:
Like this:
In Umbraco 9 there is no CachedItemRemovedCallback in Umbraco.Extensions.AppCacheExtensions:
So how do we setup something similar in Umbraco 9?
is working on a reply...