DEV Community

Cover image for How to delete cache from keycloak theme
Ismael Garcia
Ismael Garcia

Posted on

How to delete cache from keycloak theme

Developing a new theme for keycloak sometimes is hard if you have to clear the cache on every single change.

When working or developing a new keycloak theme it is better to set the configuration for the keycloak cache to false, that way every rebuild of the keycloak your changes are reflected right a way

For older version of keycloak the solution was to update the standalone.xml
then updating the theme tag

<theme>
    <staticMaxAge>-1</staticMaxAge>
    <cacheThemes>false</cacheThemes>
    <cacheTemplates>false</cacheTemplates>
    ...
</theme>
Enter fullscreen mode Exit fullscreen mode

But with the latest version of keycloak this doesn’t work anymore because there is not a standalone.xml but the solution is the following:

bin/kc.[sh|bat] start --spi-theme-static-max-age=-1 --spi-theme-cache-themes=false --spi-theme-cache-templates=false
Enter fullscreen mode Exit fullscreen mode

This is the important part, the arguments for the keycloak

--spi-theme-static-max-age=-1 --spi-theme-cache-themes=false --spi-theme-cache-templates=false

The other solution is to do delete the cache manually by:

Delete the content of the themes cache, you can do so by deleting the data/tmp/kc-gzip-cache directory of the server distribution.

Not related:

nuxt-monorepo-layers

Please if anyone have a better way please comment below and let's learn together

Working on the audio version

The Loop VueJs Podcast

Top comments (0)