mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 05:36:08 +08:00
test: cache object
This commit is contained in:
@@ -188,12 +188,9 @@ module.exports = function(app, options = {}) {
|
||||
ctx.state.data.lastBuildDate = new Date().toUTCString();
|
||||
const body = JSON.stringify(ctx.state.data);
|
||||
|
||||
if (ctx.request.method !== 'GET' || !body) {
|
||||
return;
|
||||
}
|
||||
if (Buffer.byteLength(body) > maxLength) {
|
||||
return;
|
||||
}
|
||||
// if (Buffer.byteLength(body) > maxLength) {
|
||||
// return;
|
||||
// }
|
||||
await globalCache.set(key, body, expire);
|
||||
|
||||
const type = ctx.response.headers['content-type'];
|
||||
@@ -210,7 +207,7 @@ module.exports = function(app, options = {}) {
|
||||
|
||||
const validityCheck = (routes, exclude, path) => {
|
||||
let match = false;
|
||||
let routeExpire = false;
|
||||
const routeExpire = false;
|
||||
|
||||
const paired = (route, path) => {
|
||||
const options = {
|
||||
@@ -221,11 +218,11 @@ module.exports = function(app, options = {}) {
|
||||
};
|
||||
|
||||
for (let i = 0; i < routes.length; i++) {
|
||||
let route = routes[i];
|
||||
if (typeof routes[i] === 'object') {
|
||||
route = routes[i].path;
|
||||
routeExpire = routes[i].expire;
|
||||
}
|
||||
const route = routes[i];
|
||||
// if (typeof routes[i] === 'object') {
|
||||
// route = routes[i].path;
|
||||
// routeExpire = routes[i].expire;
|
||||
// }
|
||||
if (paired(route, path)) {
|
||||
match = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user