使用getlist传输大部分评论,大幅减少网络请求数量并保证attention始终是最新的

This commit is contained in:
2020-09-03 19:25:55 +08:00
parent 99f99d39f7
commit 9e2328bf73
3 changed files with 35 additions and 5 deletions

View File

@@ -75,7 +75,7 @@ class Cache {
resolve(null);
} else if (target_version === res.version) {
// hit
console.log('comment cache hit', pid);
//console.log('comment cache hit', pid);
res.last_access = +new Date();
store.put(res);
let data = this.decrypt(pid, res.data_str);
@@ -114,7 +114,7 @@ class Cache {
data_str: this.encrypt(pid, data),
last_access: +new Date(),
});
console.log('comment cache put', pid);
//console.log('comment cache put', pid);
if (++this.added_items_since_maintenance === MAINTENANCE_STEP)
setTimeout(this.maintenance.bind(this), 1);
});