The read-write separation mode is not suitable for using mybatis secondary cache

A project uses read-write separation, but research found that this method is not suitable for using mybatis secondary cache.


Cause Analysis:

The mybatis secondary cache is based on the same namespace, and operations under different namespaces do not affect each other. The result of read-write separation is that the data sources read and written by each entity are different, that is, the namespaces are also different.

The read and write L2 caches are not the same, so when writing an update object, the written L2 cache is automatically invalidated, but the read L2 cache will not be invalidated, and the cache will continue to be used.

This leads to weak consistency. No matter how the page is refreshed, the results will still display the results before the update.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324683076&siteId=291194637