MyBatis Hazelcast integration - Reference Documentation
Hazelcast is an open source clustering and highly scalable data distribution platform for Java.
Users that want to use Hazelcast 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-hazelcast</artifactId>
<version>1.4.0-SNAPSHOT</version>
</dependency>
...
</dependencies>
then, just configure it in the mapper XML
<mapper namespace="org.acme.FooMapper">
<cache type="org.mybatis.caches.hazelcast.LoggingHazelcastCache"/>
...
</mapper>
Requirements
Follows below the version requirements:
MyBatis-Hazelcast | Hazelcast |
---|---|
1.0.x | 2.x |
1.1.x | 3.x |
1.2.x | 4.x |
1.3.x | 5.x |
Adapters
There are four Hazelcast cache adapters.
Bean | Description |
---|---|
org.mybatis.caches.hazelcast.HazelcastCache |
No-logging adapter. |
org.mybatis.caches.hazelcast.LoggingHazelcastCache |
Hazelcast cache with logging capabilities. If not sure which to choose then use this one. |
org.mybatis.caches.hazelcast.HazelcastClientCache |
Cache adapter for Hazelcast using "Hazelcast Client" API. |
org.mybatis.caches.hazelcast.LoggingHazelcastClientCache |
Same than the previous but with logging capabilities. |
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 Hazelcast as Cache.