Per-select Caching for MyBatis
Posted: August 21st, 2011 | Author: simeshev | Filed under: Distributed CachingGood news: We’ve just added support for per-select caching for MyBatis to our open source 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:
- Per-select MyBatis caches
- Ability to turn off invalidation
- Ability to turn off namespace cache
- Cache templates for select caches
For more information and examples check Cacheonix documentation: Configuring MyBatis Cache Adapter.
Enjoy!
Regards,
Slava Imeshev
Cacheonix | Reliable Distributed Java Cache

