Caching when changing template

Aug 6, 2009 at 10:16 AM


When I change a template it takes a while before the changes take place.

In version 1.1.6 this did not happen.

It is not easy to work waiting 5 to 10 minutes before the template changes.


Thank you.



Aug 6, 2009 at 10:56 AM


Yes I've implemented caching on the templates in v1.1.7.  I did have some problems with the early betas, but the latest release (beta6) should not have any issues.  Which version are you using?

(Also you can goto Backoffice>admin and restart DNN from there, this will clear the cache)



Aug 6, 2009 at 11:05 AM

We have the latest checkout from the SVN, so I think we are using the latest version (beta6).

Still the caching problem is there.


The restart on our portal is not an option because we have to many portals running.

Aug 6, 2009 at 11:17 AM



I had a look at your code, and I see in Settingscontroller.vb that the GetSettingsText() sets caches the item if it isn't in cache already.

What I don't see is that in AdminTemplates.ascx.vb, when you update an item using updateTemplate(), the item is not removed from cache.

So how does the GetSettingsText() know that item is invalid now?




Aug 6, 2009 at 1:46 PM


Strange, I've not noticed any issues with it.

The code to remove the cache is in the settings controller

        Public Sub UpdateSettingsText(ByVal PortalID As Integer, ByVal SettingName As String, ByVal Lang As String, ByVal SettingText As String)
DataProvider.Instance().UpdateNB_Store_SettingsText(PortalID, SettingName, Lang, SettingText)
removeLangCache(PortalID, "TX_" & SettingName.ToLower)
End Sub

Public Sub UpdateObjSettingsText(ByVal objInfo As NB_Store_SettingsTextInfo)
DataProvider.Instance().UpdateNB_Store_SettingsText(objInfo.PortalID, objInfo.SettingName, objInfo.Lang, objInfo.SettingText)
removeLangCache(objInfo.PortalID, "TX_" & objInfo.SettingName.ToLower)
End Sub


So each time it's updated from anywhere the cache should be removed.

I've not got time to look at it this week, so if you get chance please let me know if you find out what's happening.



Aug 6, 2009 at 5:00 PM


I found the problem.  I don't know why, but in my DNN the language isn't always lower case.  So the CacheKey is different when you get or set the cache.

I fixed it like this: In Sharedfunctions.vb I altered this functions: removeLangCache, setLangCache, getLangCache : Everywhere where a Language was used I made sure that the .ToLower() was used.

And in the file TokenStoreReplace I changed :


        Private _Lang As String = "" '#RS#

        Private _Lang As String                 into               Private _Lang As String = "" 

otherwise the Lang.ToLower() would sometimes give a "object ref not found" error



Aug 7, 2009 at 8:56 AM

Thanks Robrecht,

I'll put these changes into the next release.



Aug 7, 2009 at 8:58 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.