Search code examples
cachingumbracoumbraco7

Umbraco won't clear broken code from cache


Am creating a custom property editor for Umbraco 7. Had a a typo in the controller.js and despite what I do to clear the cache the croken code keeps showing up in the cached Dependency Handler so far I've tried:

  • Restarting application in IIS
  • Republishing Umbraco site Change
  • Clearing Browser cache
  • Change Debug="false" to Debug="true" in web.config - This worked while in debug but went back to broken cached version when I put it back to false.
  • Modify ClientDependancy.config to exclude .js from fileDependencyExtensions - Again this worked while .js was excluded but went back to broken code when I added it back again.
  • Remove the reference to the controller from the property editors manifest. - This allowed the page to load again, but obviously the the property editor then had no controller.
  • Have removed datatype and and all references, restarted application and recreated it.

There has to be an easy to do this. Any suggestions?


Solution

  • Umbraco use the ClientDependency framework to cache the backoffice assets. CDF works by caching based on the version number in the ~/Config/ClientDependency.config file. As soon as you change the version number (just make it 1 higher or lower) the caches will be regenerated and the querystrings that automatically get added to all the backoffice assets changes.

    This should bust the browser cache as well, but some browsers (Chrome especially) are very aggressive in caching assets, so on rare occasions it will also be necessary to clear your browser cache.