Per-select Caching for MyBatis

Posted: August 21st, 2011 | Author: | Filed under: Distributed Caching

Good news: We’ve just added support for per-select caching for MyBatis to our open source Java cache Cacheonix that addresses major problems with default MyBatis caching.

Problems With Default MyBatis Caching

There are a few problems with the way caching works in MyBatis:

  • MyBatis keeps results of all selects in a single, namespace-wide, cache. This means any invalidation caused by inserts or updates will flush cached results of all selects, including those that are really not affected by the changes.
  • It is impossible to ignore invalidation completely and to have pure time-only expiration for some selects.
  • It is impossible to have different cache configurations for particular selects.

Benefits of Cacheonix Adapter for MyBatis

Cacheonix have addressed these concerns by adding the following features:

  1. Per-select MyBatis caches
  2. Ability to turn off invalidation
  3. Ability to turn off namespace cache
  4. Cache templates for select caches

For more information and examples check Cacheonix documentation: Configuring MyBatis Cache Adapter.



Slava Imeshev

(No) Comments: Post a response

You must be logged in to post a comment.