Add a Mapper to cache with java api

101 Views Asked by At

I want to add a Mapper to cache with java api in MyBatis. I try this way and add Mapper's namespace to caches, but the statements of the Mapper still has no cache. is there any way to add Mapper statements into the cache?

...
Cache cache = (new CacheBuilder("package.name.SampleEntity"))
      .implementation(PerpetualCache.class)
      .addDecorator(LruCache.class)
      .clearInterval(null)
      .size(null)
      .readWrite(true)
      .blocking(false)
      .properties(new Properties())
      .build();

sqlSessionFactory.getConfiguration().addCache(cache);
...
0

There are 0 best solutions below