1

What I want to do is refreshing the view on back key. So that my user can see updated page.

So I tried to disable cache by adding:

spring.resources.cache.cachecontrol.no-cache=true

However, it doesn't work.

1
  • 1
    I'm fairly certain that browsers will load a cached version regardless of your cache control header configuration if you use the browser history (eg. a back button). JavaScript code is still executed though, and by creating a proper event listener, you should be able to reload a page in case you're using the back button, as mentioned in this question. Commented Mar 8, 2019 at 9:26

1 Answer 1

6

You can specify which cache type to use by adding spring.cache.type to your configuration. To disable it set the value to NONE.

spring.cache.type=NONE
Sign up to request clarification or add additional context in comments.

2 Comments

[docs.spring.io/spring-boot/docs/2.1.6.RELEASE/reference/html/… cache) according to this documentation it mentions: When @EnableCaching is present in your configuration, a suitable cache configuration is expected as well. If you need to disable caching altogether in certain environments, force the cache type to none to use a no-op implementation, as shown in the following example:
@jkamcc This link is broken unfortunately, and I'm really curious about "the following example" :P haha

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.