Преглед на файлове

变更修订缓存机制更新

laiguoran преди 2 години
родител
ревизия
6089f74137
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      app/service/change_ledger.js

+ 3 - 1
app/service/change_ledger.js

@@ -51,7 +51,7 @@ module.exports = app => {
                 level: 'level',
                 isLeaf: 'is_leaf',
                 fullPath: 'full_path',
-                keyPre: 'change_ledger_maxLid:',
+                keyPre: 'change_ledger_maxLid2:', // 换个名称,防止缓存导致旧数据出问题
                 uuid: true,
             };
             super(ctx, setting, 'pos');
@@ -153,6 +153,8 @@ module.exports = app => {
                         maxId = queryResult2.max_id || 0;
                     }
                 }
+                const oldCacheKey = 'change_ledger_maxLid:' + mid;
+                this.cache.del(oldCacheKey);
                 this.cache.set(cacheKey, maxId, 'EX', this.ctx.app.config.cacheTime);
             }
             return maxId;