Why is my Umbraco back office cache not clearing up when I am doing update on plugins ?

Cache Issue in Umbraco V11 Backend

In Umbraco 11, the backend utilizes minified files served as a single package. However, an issue arises when updating custom plugins, as the CSS and javascript changes may not reflect immediately.

To address this issue, you can modify the runtime minification settings in Umbraco. These settings can be found in the configuration file:

"Umbraco": {
  "CMS": {
    "RuntimeMinification": {
      "UseInMemoryCache": false,
      "CacheBuster": "Version"
    }
  }
}

There are two important settings within this section:

  1. Use 'in memory' cache: This setting determines whether the cached output from Smidge (the minification tool) should be stored in memory or on the disk. When set to false, a "Smidge" folder will be created in the "wwwroot" directory of your Umbraco site to store the cache.

  2. Cache buster: This setting specifies the mechanism for cache invalidation. The available options are:

    • Version: The cache will be invalidated when there are changes to the assembly version, the upstream Umbraco version, or the version string specified in the configuration.
    • AppDomain: The cache will be invalidated when the application restarts.
    • Timestamp: The cache will be invalidated based on a timestamp of the bundled files.

If you choose the "Version" cache buster option, you can manually increment the version number in the configuration to ensure the cache is busted. Here's an example configuration:

"Umbraco": {
  "CMS": {
    "RuntimeMinification": {
      "UseInMemoryCache": true,
      "CacheBuster": "Version",
      "Version": "1234"
    }
  }
}

Please note that the actual "Version" number will not be visible in the URL of the assets. Instead, it is combined with the Umbraco version from the configuration and the project assembly DLL. This combined information is then hashed to obscure the details. For example:

<link href='/sb/umbraco-backoffice-init-css.css.v7a71f91360259c5f7c3337f152b0df01eeee36f0' rel='stylesheet' type='text/css'/>

Even if you increase the version in the configuration by 1 (e.g., from 1234 to 1235), you will only see a different hash.

For production environments, it is recommended to set the Cache Buster to either 'Version' (you can control cache breaks by adjusting the version number, especially when installing new assets) or 'AppDomain'.

Additionally, Smidge provides another configuration option called "dataFolder" that specifies the folder used for temporary data. Generally, there is no need to change this setting unless you have set UseInMemoryCache to false.

I personally tend to use the AppDomain configuration so the cache is invalidated each time you restart your website/application.