修复集群环境下,修改接口名字可能未同步的BUG

This commit is contained in:
mxd
2021-08-07 11:24:32 +08:00
parent 47553c0822
commit 1d6acce6e0
2 changed files with 2 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ public class DatabaseResource extends KeyValueResource {
@Override
public void readAll() {
this.cachedContent.entrySet().removeIf(entry -> entry.getKey().startsWith(path));
String sql = String.format("select file_path, file_content from %s where file_path like '%s%%'", tableName, this.path);
SqlRowSet sqlRowSet = template.queryForRowSet(sql);
while (sqlRowSet.next()) {

View File

@@ -33,6 +33,7 @@ public class RedisResource extends KeyValueResource {
public void readAll() {
List<String> keys = new ArrayList<>(keys());
List<String> values = redisTemplate.opsForValue().multiGet(keys);
this.cachedContent.entrySet().removeIf(entry -> entry.getKey().startsWith(path));
if (values != null) {
for (int i = 0, size = keys.size(); i < size; i++) {
this.cachedContent.put(keys.get(i), values.get(i));