mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-07-04 14:49:19 +00:00
缓存清理
This commit is contained in:
parent
fb9be8ded7
commit
36c5a2ebea
@ -5,6 +5,17 @@ import logger from '../../utils/core/logger';
|
|||||||
|
|
||||||
class WordsService {
|
class WordsService {
|
||||||
private wordCache: Record<string, string[]> = {}; //缓存
|
private wordCache: Record<string, string[]> = {}; //缓存
|
||||||
|
private readonly clearIntervalMs = 30 * 60 * 1000; //30min
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.startAutoClear();
|
||||||
|
}
|
||||||
|
private startAutoClear() {
|
||||||
|
setInterval(() => {
|
||||||
|
logger.info('[WordsService] Clearing wordCache..');
|
||||||
|
this.wordCache = {};
|
||||||
|
}, this.clearIntervalMs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从本地加载json到内存&返回
|
* 从本地加载json到内存&返回
|
||||||
|
Loading…
x
Reference in New Issue
Block a user