MyBatis OSCache integration - Reference Documentation

Unfortunately, OpenSymphony has seen it's final days, and OSCache won't be maintained anymore.

OSCache is a high performances caching solution developed and maintained by Open Symphony and easily integrated in MyBatis since the iBATIS version 2.X.

Since MyBatis 3 comes without it, and we strongly use it, we decided to reintroduce its use.

Users that want to use OScache 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-oscache</artifactId>
    <version>1.0.2</version>
  </dependency>
  ...
</dependencies>

then, just configure it in the mapper XML

<mapper namespace="org.acme.FooMapper">

  <cache type="org.mybatis.caches.oscache.OSCache"/>

  ...

</mapper>

If users need to log cache operations, they can plug the Cache logging version:

<mapper namespace="org.acme.FooMapper">

  <cache type="org.mybatis.caches.oscache.LoggingOSCache"/>

  ...

</mapper>

For proper OSCache configuration please read the offical reference