Home > Back-end >  Mybatis query the database how to turn off caching, let go every time database
Mybatis query the database how to turn off caching, let go every time database

Time:03-02


Mybatis version: 3.2.7/3.2.8
Just go when it begins to login query database, but to the back, the data returned is all the previous query data, check information that the cache is shut, but no effect,
Another thread is in timing query of data in the database, or a similar situation, but every time I get new sqlsession query data access database data, if use a sqlsession database will not go, all cached data,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Mapper annotations used on
@ the Options (flushCache=true)
List SelectByExample (UserExample example);


The XML file and flushCache="true" useless

CodePudding user response:

Every time a most the very way is change the execution of SQL, the cache mechanism is every time to check whether the same, if the same is in the cache access; And try to release the cache, after completion of each release

CodePudding user response:

Finduserbyuser code inside out

CodePudding user response:


This is the code and the service layer UserMapper. The XML code

CodePudding user response:

refer to the second floor nayi_224 response:
finduserbyuser inside the code to the

This is findUserByUser code

CodePudding user response:

reference 1st floor HuangHe201691 response:
is a most the very way every time change the execution of SQL, the cache mechanism is every time to check whether the same, if the same is in the cache access; And try to release the cache, after completion of each release

May it is as you say this!
  • Related