Enable cache mechanism for entire application based on flag from properties file

27 views Asked by At

I want to enable/disable spring boot( redis )cache based on the flag set in the properties file.

Suppose I set cacheEnabled=true in the properties file then it should not consider cache mechanism for entire application Use Case:I have different client and some may have cache mechanism and some does not..So I just need to set caching based on the flag in the properties file without touching code..(properties file i can read externally)

I tried conditional SPEL based on the flag set from properties but it appear to be only on method..when i use @EnableCaching at main class and @cachable then application started but when i trigger request its saying connection refused..

I just need to use redis for my application and keep all the code as is..and based on the flag without touching any code..i need to enable or disable cache mechanism..Can anyone help me on this please.

0

There are 0 answers