mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(core): caching enhancements (#9227)
* fix(core): redis cache ignore `maxAge` when refreshing memory cache do not have such a problem Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com> * feat(core): make `cache.tryGet()` refreshing selectable Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com> * docs: `ctx.cache.tryGet()` update Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com>
This commit is contained in:
@@ -292,7 +292,7 @@ const description = await ctx.cache.tryGet(link, async () => {
|
||||
});
|
||||
```
|
||||
|
||||
tryGet 的实现可以看[这里](https://github.com/DIYgod/RSSHub/blob/master/lib/middleware/cache/index.js#L58),第一个参数为缓存的 key,第二个参数为缓存数据获取方法,第三个参数为缓存时间,正常情况不应该传入,缓存时间默认为 [CACHE_CONTENT_EXPIRE](/install/#缓存配置),且每次访问缓存会重新计算过期时间
|
||||
tryGet 的实现可以看[这里](https://github.com/DIYgod/RSSHub/blob/master/lib/middleware/cache/index.js#L58)。第一个参数为缓存的 key;第二个参数为缓存未命中时的数据获取方法;第三个参数为缓存时间,正常情况不应该传入,缓存时间默认为 [CACHE_CONTENT_EXPIRE](/install/#缓存配置);第四个参数为控制本次尝试缓存命中时是否需要重新计算过期时间(给缓存「续期」)的开关,`true` 为打开,`false` 为关闭,默认为打开
|
||||
|
||||
* * *
|
||||
|
||||
|
||||
Reference in New Issue
Block a user