Files
RSSHub/lib/routes/patchwork.kernel.org/cache.js
2019-05-09 01:23:29 +08:00

18 lines
529 B
JavaScript

const axios = require('../../utils/axios');
module.exports = {
getPatchnameFromID: async (ctx, id) => {
const key = 'patchwork-kernel-org-patchname-from-id-' + id;
let name = await ctx.cache.get(key);
if (!name) {
const patchDetail = await axios({
method: 'get',
url: `https://patchwork.kernel.org/api/patches/${id}/`,
});
name = patchDetail.data.name;
ctx.cache.set(key, name);
}
return name;
},
};