Cache of MyBatis
Default caching rules for MyBatis:
All select statements in the mapping statement file will be cached.
All insert,update and delete statements in the mapping statement file flush the cache.
The cache is retrieved using the Least Recently Used (LRU, the least recently used) algorithm.
Depending on the schedule (such as no Flush Interval, there is no refresh interval), the cache is not refreshed in any chronological order.
The cache stores 1024 references to a list collection or object, no matter what the query method returns.
The cache is treated as a read/write (readable / writable) cache, meaning that object retrieval is not shared and can be safely modified by callers without interfering with potential modifications made by other callers or threads
Basic configuration:
Available recycling strategies:
LRU-least recently used: remove objects that have not been used for the longest time.
FIFO-FIFO: removes objects in the order in which they enter the cache.
SOFT-soft reference: removes objects based on garbage collector state and soft reference rules.
WEAK-weak references: more actively remove objects based on garbage collector state and weak reference rules.
Use a custom cache: