Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Remove external cache locking #159
MyBatis gets a ReadWriteLock from the cache provider and calls read.lock() and write.lock() when calling getObject() and putObject().
The default cache provides its own Synchronized decorator that makes sure that accesses to cache are properly synchronized. So in this case we are doing two locks and only one is needed.
In the case of 3rd party cache providers like Hazelcast, EhCache... they already provide sharper locking and do not need any extra external locking.
This change may affect those that have implemented or extended the MyBatis default cache.
From now over Cache implementors can just return null in getReadWriteLock method.