问题
I'm having real problem with caching in a macro. I've set the cache period to 0 but still a dropdownlist that returns a list of other items in the content tree won't update until I force the application to recycle e.g. touch the web.config file.
The Macro uses umbraco.content.Instance.XmlContent.SelectSingleNode to select a parent node and then loops through the children and adds these to the dropdownlist.
When I add a new child to this node it doesn't appear in the dropdownlist even if I publish the entire website again.
I'm not sure where this caching is taking place. Can anyone point me in the right direction?
回答1:
Try adding ?umbdebug=true or ?umbdebugshowtrace=true to any page on your website, it will display trace/macro information.
This video series, maybe helpful http://umbraco.tv/documentation/videos/for-developers/foundation/macro-caching
回答2:
Try putting umbraco.library.UpdateDocumentCache(docId);
before the SelectSingleNode call and see if it works.
回答3:
You can easily solve your caching problem by providing version to a particular file like css, .js or change something into the web.config file whenever you will go for the deployment.
For example : If we have Script.js file then change version of file for Script.js ?123.
When we changed the version of a file then server will get the latest code from that file.
Let me know if you have any further query.
Thanks
来源:https://stackoverflow.com/questions/3263976/umbraco-caching