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
Hello everyone,
I can't seem to find a way to list what has been cached in the RuntimeCache.
Is there a way to see what has been insterted into the cache, from statements like these but without knowing the full key name?
cache.InsertCacheItem("CacheName_SomethingSomething", () => contentItems, timeout: TimeSpan.FromMinutes(10));
Thank you! Genc
Hi Genc,
This is explained in the documentation here : https://our.umbraco.org/documentation/Reference/Cache/updating-cache
Read the part about adding and retreiving. You can use the same call for adding and retreiving.
Dave
Hi Date, thank you!
The way I've understood this is that I need to know the key (in this case ""MyCacheKey"). But what if I want to get a list of whatever is cached, without knowing the key name? There seems to be no "GetCacheItems()" is there?
Thank you, Genc
This is not possible using the Umbraco API.
But you can do something like this :
IDictionaryEnumerator enumerator = System.Web.HttpRuntime.Cache.GetEnumerator(); while (enumerator.MoveNext()) { string key = (string)enumerator.Key; object value = enumerator.Value; ... }
And that would list them all.
Thank you Dave, didn't realize Umbraco was using "System.Web.HttpRuntime.Cache". Might have missed that bit.
Thank you for your help! Genc
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
List cached items in the RuntimeCache
Hello everyone,
I can't seem to find a way to list what has been cached in the RuntimeCache.
Is there a way to see what has been insterted into the cache, from statements like these but without knowing the full key name?
cache.InsertCacheItem("CacheName_SomethingSomething", () => contentItems, timeout: TimeSpan.FromMinutes(10));
Thank you! Genc
Hi Genc,
This is explained in the documentation here : https://our.umbraco.org/documentation/Reference/Cache/updating-cache
Read the part about adding and retreiving. You can use the same call for adding and retreiving.
Dave
Hi Date, thank you!
The way I've understood this is that I need to know the key (in this case ""MyCacheKey"). But what if I want to get a list of whatever is cached, without knowing the key name? There seems to be no "GetCacheItems()" is there?
Thank you, Genc
Hi Genc,
This is not possible using the Umbraco API.
But you can do something like this :
And that would list them all.
Dave
Thank you Dave, didn't realize Umbraco was using "System.Web.HttpRuntime.Cache". Might have missed that bit.
Thank you for your help! Genc
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.