Springboot Redis not save in cache if return value is false

Viewed 14

I need to save this cache once response is true only.

If it is false then no need to save it in the cache.

@Cacheable(value = RedisCacheConfig.CONFIGURATION_CACHE, key  = "#username.concat('_').concat(#channel)", cacheManager = RedisCacheConfig.CACHE_MANAGER)
public Boolean getConfigurations( String username, String channel, ValidateAccess validateAccess){
    Boolean response = configurationService.validateAdAndFetchRole(username, validateAccess);
    return response;
}

How I can achieve this logic here?

0 Answers
Related