fix(chore): contentExpire not work
This commit is contained in:
@@ -38,13 +38,13 @@ module.exports = function(app, options = {}) {
|
||||
if (key) {
|
||||
let value = await redisClient.get(key);
|
||||
if (value) {
|
||||
await redisClient.expire(key, config.cache.routeExpire);
|
||||
await redisClient.expire(key, config.cache.contentExpire);
|
||||
value = value + '';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
set: async function(key, value, maxAge = config.cache.routeExpire) {
|
||||
set: async function(key, value, maxAge = config.cache.contentExpire) {
|
||||
if (await redisClient.exists(key)) {
|
||||
logger.warn(`repeated key: ${key}, ${value}`);
|
||||
return;
|
||||
@@ -89,7 +89,7 @@ module.exports = function(app, options = {}) {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
set: (key, value, maxAge = config.cache.routeExpire) => {
|
||||
set: (key, value, maxAge = config.cache.contentExpire) => {
|
||||
if (!value || value === 'undefined') {
|
||||
value = '';
|
||||
}
|
||||
@@ -125,7 +125,7 @@ module.exports = function(app, options = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
app.context.cache.tryGet = async function(key, getValueFunc, maxAge = config.cache.routeExpire) {
|
||||
app.context.cache.tryGet = async function(key, getValueFunc, maxAge = config.cache.contentExpire) {
|
||||
let v = await this.get(key);
|
||||
if (!v) {
|
||||
v = await getValueFunc();
|
||||
|
||||
Reference in New Issue
Block a user