Ehcache is a distributed cache framework.
1 Distributed Cache
Our system to improve the system concurrency, performance, general Distributed system Deployment (cluster deployment mode)
Without the use of distributed caches, cached data is stored separately in each service and is inconvenient for system development. Therefore, the cached data is centrally managed using distributed caching.
MyBatis cannot implement distributed caching and needs to be integrated with other distributed cache frameworks
2 Integration methods
MyBatis provides a cache interface, and if you want to implement your own cache logic, implement the cache interface development.
MyBatis and Ehcache integration, the MyBatis and Ehcache integration packages provide an implementation class for the cache interface.
The MyBatis default implementation of the Cache class is:
3 Add Ehcache Pack
4 Integrated Ehcache
Configure the type of the cache in the mapper to be the implementation of the Ehcache to the cache interface.
5 Adding a Ehcache configuration file
Configure the Ehcache.xml under Classpath
MyBatis Integrated Ehcache