RSSHub/middleware
cnzgray d1c50b0c7e 提案: 添加一个`tryGet`方法到cache工具中。 (#1130)
在抓取一些博客或者论坛的时候,有时候会系统抓取内容页面作为desc。
大多数的做法是获取子页面的地址,然后判断是否已经缓存结果,如果没有则获取,然后设置到缓存中。
这做法固然没有问题,这里只是提供一种新的思路,以将子页面的抓取逻辑独立出去便于逻辑实现。

使用方法:
```
const loadContent = async (link) => {
    // 执行页面加载,解析内容等操作。
    // 最终返回一个结果,该结果将被缓存。
    return result;
}
const result = await ctx.cache.tryGet(link, async () => loadContent(link), 3 * 60 * 60);
```
2018-11-13 10:57:13 +08:00
..
access-control.js 修复黑白名单逻辑 (#844) 2018-10-09 01:21:22 +08:00
api-response-handler.js Add middlewares for API and various improvements (#685) 2018-09-12 12:00:47 +08:00
api-template.js Add middlewares for API and various improvements (#685) 2018-09-12 12:00:47 +08:00
cache-common.js 精简缓存逻辑,精简文档 (#915) 2018-10-18 09:44:45 +08:00
debug.js app: debug: add hot ips 2018-05-17 15:48:35 +08:00
header.js app: move some variables outside module.exports for a better performance 2018-06-02 17:31:33 +08:00
lru-cache.js 提案: 添加一个`tryGet`方法到cache工具中。 (#1130) 2018-11-13 10:57:13 +08:00
onerror.js app: remove useless console.log 2018-09-12 17:38:14 +08:00
parameter.js rss: telegram instant view mode param (#977) 2018-10-26 11:03:30 +08:00
redis-cache.js 提案: 添加一个`tryGet`方法到cache工具中。 (#1130) 2018-11-13 10:57:13 +08:00
template.js app: remove json in type regrx 2018-11-11 15:13:37 +08:00
utf8.js 拯救翻车的 API (#698) 2018-09-15 13:55:59 +08:00