As far as caching with spring boot is concerned, spring supports the following cache providers, as it has been mentioned in the following link.
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-caching.html
To quote, It says
If you have not defined a bean of type CacheManager or a CacheResolver
named cacheResolver (see CachingConfigurer), Spring Boot tries to
detect the following providers (in the indicated order):
- Generic
- JCache (JSR-107) (EhCache 3, Hazelcast, Infinispan, and others)
- EhCache 2.x
- Hazelcast
- Infinispan
- Couchbase
- Redis
- Caffeine
- Simple
I will suggest to use Ehcache, you can check more details on Ehcache with Spring framework in the below link.
https://www.baeldung.com/spring-cache-tutorial
If you are only interested about JCS, then refer below the link to have an understanding.
https://codyburleson.com/quick-and-simple-caching-with-apache-commons-jcs/
In case pf Spring boot, I will suggest to create class and wrap JCS inside that class so that you can wire in any class so that you can abstract away the JCS implementation details. I provide below outline.
@Autowired CacheUpdater cacheUpdate;
in the method, you can write like this,
public void someMethod(... params) {
cacheUpdater.update(key,value)
}
It is not necessary that, you have to have a method called update(), you can create any method and it should internally call JCS to put the key and value in cache.