JCache with EHCache implementation - ehcache

Does EHCache implemenation of JCache supports Distributed caching feature?
My requirement is Distributed Client-Server Cache: Multiple cache (clustered) nodes, collaborating in a distributed fashion and executing in isolation from the client application.
Thanks

Note: I am a developer working on Ehcache
Ehcache, depending on version, has two different ways it is integrated with JSR-107 / JCache:
Version 2.x needs the ehcache-jcache wrapper
Version 3, under active development, is a native implementation of it.
In both cases, while using the JSR-107 / JCache API in your application, you can benefit from the whole set of options available to native Ehcache. This includes the clustering support:
It is available with Ehcache 2.10.1 and Terracotta 4.3.1 today
It will be included in Ehcache 3. It has been released and is available with Ehcache 3.1 and above.

Related

Spring 4 support for Caffeine Cache

I was trying to find some examples and evidence if Spring 4.0.3 version support caffeine cache integration? If yes, what caffeine cache version is supported for Spring 4.0.3?
Support was added in Spring Framework 4.3 and in Spring Boot 1.4. Previously you could use the Guava provider, which was the baseline for Caffeine's. That will likely be a good approach until you are ready to upgrade. If you really need to use Caffeine for performance reasons then you might try this alternative integration.

Alternate between Spring Boot cache and GemFire

I have a Spring Boot app with caching enabled using the #EnableCaching in the main class and #Cacheable for certain methods. This was earlier working well.
Now I have also configured GemFire cache to store other data.
The older code with the #Cacheable annotation is now trying to fetch this data in the GemFire cache. Is there a way to define when to use which cache?
I'm new to this and would appreciate any inputs on the best practice to be followed in such case and what can be done to overcome this.
Have a look at this: https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/#geode-caching-provider, and specifically this: https://docs.spring.io/spring-boot-data-geode-build/current/reference/html5/#geode-caching-provider-disable.
If you are not using Spring Boot for Apache Geode (SBDG; see project home as well as the docs) (which also applies to VMware Tanzu GemFire as well, given GemFire is based on OSS, Apache Geode), then you most definitely should consider it.
If you need to control which cache is used for which, e.g. service method, then you should read more about custom cache resolution as opposed to the default cache resolution strategy.
Last, SBDG honors Spring Boot's Caching configuration, after SBDG is essentially Spring Boot specifically designed and developed for Apache Geode (and GemFire).

which ehcache version should I use

I am getting started with ehcache(standalone server caching) and confused with different versions.
I have noticed that maven groupid for ehcache 2.x and 3.x is net.sf.ehcache and org.ehcache respectively, which suggests that ehcache versions 2.x and 3.x are for different purpose.
The change of major version coupled with the change of groupId is used to indicate that Ehcache 3.x is not compatible with Ehcache 2.x at the API level.
Both libraries are about caching, from small caches in-memory to distributed caches. Ehcache 3 is also fully compatible with the javax.cache API, the caching standard in Java.
Unless you have third party libraries that do not work yet with Ehcache 3, I recommend picking that version. It is the one under active development. Note that as of Ehcache 3.5, Java 8 is required.
You can of course look at features of each major version on http://ehcache.org.

Why is GuavaCacheConfiguration deprecated in Spring Boot 1.5.3?

I was thinking about replacing custom Guava cache configuration with AutoConfiguration... but found that the latter one is deprecated already.
Tried searching in Spring Boot documentation and GitHub repo, but has not found a clear answer. It's just deprecated in stable version and removed in master.
I respect (and use) both Spring Boot & Guava, so I'd like to understand the reason of this change.
Search for "Guava" in Spring Boot features - Caching and it says that should use Caffeine instead:
Caffeine is a Java 8 rewrite of Guava’s cache and will supersede the
Guava support in Spring Boot 2.0.
It's basically Guava cache on steroids (it has similar interface), so the switch should be straightforward.

Can Infinispan be implemented as cache manager for Apache Shiro?

Apache Shiro allows some implementations for CacheManager. EHCache is one of these implemenations.
I'd like to use Infinispan as Distributed Cache Manager. Until now, I'm not sure wheter it's feasible or not.
Does anybody know how to implement Infinispan as CacheManager for Apache Shiro ?
Thanks
I just uploaded Shiro Infinispan support project to GitHub (https://github.com/zbiljic/shiro-infinispan).
It's almost exact copy of EHCache implementation, but uses Infinispan instead.
I created this, and 'shiro-redis' project a year ago for some internal application, but never had the time to upload it.
We use it in production for some time now.

Resources