public static int GetInfoObject(int contentId) { var cache = DataCache.GetCache(Constants.ModuleCacheKey + Constants.ContentType + contentId.ToString()); if (cache == null) { var timeOut = 20 * Convert.ToInt32(Host.PerformanceSetting); cache = controller.GetInfoObject(contentId); if (timeOut > 0 & cache != null) { DataCache.SetCache(Constants.ModuleCacheKey + Constants.ContentType + contentId.ToString(), cache, TimeSpan.FromMinutes(timeOut)); } } return cache; }
06
Jun
The most expensive bottleneck in your application is asking for data from your SQL database. The fact of the matter is that it doesn't matter is it doesn't how many rows of data you request, the sheer request itself is costly.
The function below illustrates how easy it is to cache an object in DotNetNuke. It's as simple as calling a standard function; checking in the cache if the value already exists; if not go get the data and then add it to the cache; return the cached object.