Skip to content

Remove external cache locking #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emacarron opened this issue Mar 11, 2014 · 1 comment
Closed

Remove external cache locking #159

emacarron opened this issue Mar 11, 2014 · 1 comment
Assignees
Labels
enhancement Improve a feature or add a new feature
Milestone

Comments

@emacarron
Copy link
Member

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.

@YuShiwen
Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve a feature or add a new feature
Projects
None yet
Development

No branches or pull requests

2 participants