mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-08-09 02:24:25 +00:00
feature: extend default card cache time to 6 hours (#3242)
* feature: extend default card cache time to 8 hours * reduce to six hours
This commit is contained in:
+3
-3
@@ -34,8 +34,8 @@ export default async (req, res) => {
|
||||
const gistData = await fetchGist(id);
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.FOUR_HOURS, 10),
|
||||
CONSTANTS.FOUR_HOURS,
|
||||
parseInt(cache_seconds || CONSTANTS.SIX_HOURS, 10),
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
@@ -52,7 +52,7 @@ export default async (req, res) => {
|
||||
const isBothOver1K = stars > 1000 && forks > 1000;
|
||||
const isBothUnder1 = stars < 1 && forks < 1;
|
||||
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
|
||||
cacheSeconds = CONSTANTS.FOUR_HOURS;
|
||||
cacheSeconds = CONSTANTS.SIX_HOURS;
|
||||
}
|
||||
|
||||
res.setHeader(
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ export default async (req, res) => {
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.FOUR_HOURS,
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ export default async (req, res) => {
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.FOUR_HOURS,
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
@@ -58,7 +58,7 @@ export default async (req, res) => {
|
||||
const isBothOver1K = stars > 1000 && forks > 1000;
|
||||
const isBothUnder1 = stars < 1 && forks < 1;
|
||||
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
|
||||
cacheSeconds = CONSTANTS.FOUR_HOURS;
|
||||
cacheSeconds = CONSTANTS.SIX_HOURS;
|
||||
}
|
||||
|
||||
res.setHeader(
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ export default async (req, res) => {
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.FOUR_HOURS,
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ export default async (req, res) => {
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.FOUR_HOURS,
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
|
||||
Reference in New Issue
Block a user