MyBatis Caffeine integration - Reference Documentation
Caffeine is an open source clustering and highly scalable data distribution platform for Java.
Users that want to use Caffeine into their applications, have to download the
zip bundle,
decompress it and add the jars in the classpath.
Apache Maven users instead can simply add in the pom.xml
the following dependency:
<dependencies>
...
<dependency>
<groupId>org.mybatis.caches</groupId>
<artifactId>mybatis-caffeine</artifactId>
<version>1.2.0</version>
</dependency>
...
</dependencies>
then, just configure it in the mapper XML
<mapper namespace="org.acme.FooMapper">
<cache type="org.mybatis.caches.caffeine.CaffeineCache"/>
...
</mapper>
Requirements
Follows below the version requirements:
MyBatis-Caffeine | Caffeine |
---|---|
1.0.0.beta1 | 2.8.0 |
1.0.0 | 2.9.x (jdk-8) or 3.0.x (jdk-11) |
Adapters
There are just one Caffeine cache adapters.
Bean | Description |
---|---|
org.mybatis.caches.caffeine.CaffeineCache |
No-logging adapter. |
Logging versions of the adapter log cache hit ratios using the namespace as a logger.
Please refer to the official documentation to know more details how to configure Caffeine as Cache.