Already been there. What i don't get, is how i get from what is in the documentation to what i have.
I saw this other site also
http://bitwizards.com/blog/march-2014/how-to-leverage-the-kentico-caching-api-in-your-co?eid=3
and tried to do something similar:
public static string GetCategory(int documentId)
{
if (documentId < 1)
{
throw new Exception("Invalid document ID");
}
int cacheMinutes = SettingsKeyInfoProvider.GetIntValue(SiteContext.CurrentSiteName + ".CMSCacheMinutes");
DataSet docscat = null;
using (var cs = new CachedSection<DataSet>(ref docscat, cacheMinutes, true, null, "categorycache"))
{
if (cs.LoadData)
{
docscat = CategoryInfoProvider.GetDocumentCategories(documentId, "CategoryNamePath LIKE '/Type/%'", "CategoryOrder ASC", 100, "CMS_Category.CategoryID, CategoryDisplayName, CategoryNamePath, CategoryOrder");
cs.Data = docscat;
return ValidationHelper.GetString(docscat.Tables[0].Rows[0]["CategoryDisplayName"], null);
}
return ValidationHelper.GetString(cs.GetData().Tables[0].Rows[0]["CategoryDisplayName"], null);
}
}
The problem is that it only IF(cs.LoadData) only runs once, so i only get one category, instead of the 40+