Replaced argv dependency with options argument.

This commit is contained in:
DebaucheryLibrarian 2024-10-31 03:12:10 +01:00
parent 4316b69a43
commit 83294ec6f4
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
export async function resolvePlace(query, context) { export async function resolvePlace(query, context, options = {}) {
if (!query) { if (!query) {
return null; return null;
} }
@ -6,7 +6,7 @@ export async function resolvePlace(query, context) {
const cacheKey = `place-${context.slugify(query)}`; const cacheKey = `place-${context.slugify(query)}`;
const cachedPlace = await context.redis.hGetAll(cacheKey); const cachedPlace = await context.redis.hGetAll(cacheKey);
if (context.argv.placeCache !== false && await context.redis.exists(cacheKey)) { if (options.useCache !== false && await context.redis.exists(cacheKey)) {
await context.redis.expire(cacheKey, 3600 * 24 * 30); await context.redis.expire(cacheKey, 3600 * 24 * 30);
context.logger.debug(`Using cached place '${cacheKey}' for query '${query}': ${JSON.stringify(cachedPlace)}`); context.logger.debug(`Using cached place '${cacheKey}' for query '${query}': ${JSON.stringify(cachedPlace)}`);