mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-14 09:25:55 +08:00
Nick: acuc cache on now
This commit is contained in:
parent
b415e625a0
commit
0446443bbe
@ -64,8 +64,8 @@ export async function setCachedACUC(
|
|||||||
throw signal.error;
|
throw signal.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache for 1 hour. - mogery
|
// Cache for 10 minutes. - mogery
|
||||||
await setValue(cacheKeyACUC, JSON.stringify(acuc), 3600, true);
|
await setValue(cacheKeyACUC, JSON.stringify(acuc), 600, true);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Error updating cached ACUC ${cacheKeyACUC}: ${error}`);
|
logger.error(`Error updating cached ACUC ${cacheKeyACUC}: ${error}`);
|
||||||
@ -160,14 +160,14 @@ export async function getACUC(
|
|||||||
|
|
||||||
const cacheKeyACUC = `acuc_${api_key}_${isExtract ? "extract" : "scrape"}`;
|
const cacheKeyACUC = `acuc_${api_key}_${isExtract ? "extract" : "scrape"}`;
|
||||||
|
|
||||||
// if (useCache) {
|
if (useCache) {
|
||||||
// const cachedACUC = await getValue(cacheKeyACUC);
|
const cachedACUC = await getValue(cacheKeyACUC);
|
||||||
// if (cachedACUC !== null) {
|
if (cachedACUC !== null) {
|
||||||
// return JSON.parse(cachedACUC);
|
return JSON.parse(cachedACUC);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (!cacheOnly) {
|
if (!cacheOnly) {
|
||||||
let data;
|
let data;
|
||||||
let error;
|
let error;
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
@ -205,14 +205,14 @@ export async function getACUC(
|
|||||||
data.length === 0 ? null : data[0].team_id === null ? null : data[0];
|
data.length === 0 ? null : data[0].team_id === null ? null : data[0];
|
||||||
|
|
||||||
// NOTE: Should we cache null chunks? - mogery
|
// NOTE: Should we cache null chunks? - mogery
|
||||||
// if (chunk !== null && useCache) {
|
if (chunk !== null && useCache) {
|
||||||
// setCachedACUC(api_key, isExtract, chunk);
|
setCachedACUC(api_key, isExtract, chunk);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return chunk ? { ...chunk, is_extract: isExtract } : null;
|
return chunk ? { ...chunk, is_extract: isExtract } : null;
|
||||||
// } else {
|
} else {
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setCachedACUCTeam(
|
export async function setCachedACUCTeam(
|
||||||
@ -244,8 +244,8 @@ export async function setCachedACUCTeam(
|
|||||||
throw signal.error;
|
throw signal.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache for 1 hour. - mogery
|
// Cache for 10 minutes. - mogery
|
||||||
await setValue(cacheKeyACUC, JSON.stringify(acuc), 3600, true);
|
await setValue(cacheKeyACUC, JSON.stringify(acuc), 600, true);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Error updating cached ACUC ${cacheKeyACUC}: ${error}`);
|
logger.error(`Error updating cached ACUC ${cacheKeyACUC}: ${error}`);
|
||||||
@ -275,14 +275,14 @@ export async function getACUCTeam(
|
|||||||
|
|
||||||
const cacheKeyACUC = `acuc_team_${team_id}_${isExtract ? "extract" : "scrape"}`;
|
const cacheKeyACUC = `acuc_team_${team_id}_${isExtract ? "extract" : "scrape"}`;
|
||||||
|
|
||||||
// if (useCache) {
|
if (useCache) {
|
||||||
// const cachedACUC = await getValue(cacheKeyACUC);
|
const cachedACUC = await getValue(cacheKeyACUC);
|
||||||
// if (cachedACUC !== null) {
|
if (cachedACUC !== null) {
|
||||||
// return JSON.parse(cachedACUC);
|
return JSON.parse(cachedACUC);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (!cacheOnly) {
|
if (!cacheOnly) {
|
||||||
let data;
|
let data;
|
||||||
let error;
|
let error;
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
@ -321,14 +321,14 @@ export async function getACUCTeam(
|
|||||||
data.length === 0 ? null : data[0].team_id === null ? null : data[0];
|
data.length === 0 ? null : data[0].team_id === null ? null : data[0];
|
||||||
|
|
||||||
// NOTE: Should we cache null chunks? - mogery
|
// NOTE: Should we cache null chunks? - mogery
|
||||||
// if (chunk !== null && useCache) {
|
if (chunk !== null && useCache) {
|
||||||
// setCachedACUC(api_key, chunk);
|
setCachedACUCTeam(team_id, isExtract, chunk);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return chunk ? { ...chunk, is_extract: isExtract } : null;
|
return chunk ? { ...chunk, is_extract: isExtract } : null;
|
||||||
// } else {
|
} else {
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function clearACUC(api_key: string): Promise<void> {
|
export async function clearACUC(api_key: string): Promise<void> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user