Inconsistency of cached data after integration of MyBatis and Memcached

The process of generating cached data to memcache is as follows:

1. Query data:

1. Convert the cached sqlKey value according to the executed sql statement
2. Query the cached data of memcache according to the sqlKey value
3. If the cached data is queried, return the cached data
4. If If the cached data cannot be queried, execute
the sql query. 5. Convert the cached sqlKey value according to the executed sql statement.
6. Generate groupKey according to the mapper namespace.
7. The sql query result is placed in the cache. value), object (sql query result)]
8. The cached sqlKey value converted by the sql statement is associated with the groupKey, the data structure [groupKey,[sqlKey1,sqlKey2,sqlKey3,...](set result set)]


2. Add, delete, modify data:
1. Execute insert, delete or update sql
2. Generate groupKey according to mapper namespace
3. Query sqlKey according to groupKey
4. Delete sqlKey cached data cyclically according to sqlKey set size
5. Finally delete groupKey cached data

 

Guess you like

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