I read through the caching deep dive, but I still have a question.
I have a custom table whose code name is customtable.FeaturedContent2 (namespace.customTable). I have a custom web part that pulls data from the custom table:
DataSet dataSet = null;
using (var cs = new CachedSection<DataSet>(ref dataSet, 60, true, null, "featured-getCustomTableData|", isActive))
{
if (cs.LoadData)
{
var dataInfoClass = getDataInfoClass();
var ctiProvider = getItemProvider();
string where = (isActive) ? "[IsActive] = 1" : "[IsActive] = 0";
dataSet = ctiProvider.GetItems(dataInfoClass.ClassName, where, "[ContentClassName]");
cs.CacheDependency = CacheHelper.GetCacheDependency("featuredcontent2|all");
cs.Data = dataSet;
}
}
return dataSet;
When I step through the code, I see that the code only enters the if statement the first time, so the caching is working.
However, if I go to CMS Desk > Tools > Custom tables > Featured Content2 > Edit custom table item, make a change, and hit save, I thought that Kentico would then expire this cache item. The code, in theory, would then enter the if statement and load the freshest data.
But stepping through the code, the API loads the item from the cache, and does not enter the if statement.
I also tried changing the getcachdependency line:
CacheHelper.GetCacheDependency("customtable.featuredcontent2|all");
But this has the same result as the previous.
Is my cache key set correctly?