Google Maps Bug

This commit is contained in:
Eric Gullickson
2025-11-08 12:17:29 -06:00
parent efbe9ba3c0
commit bb4a356b9e
39 changed files with 1175 additions and 449 deletions

View File

@@ -51,6 +51,34 @@ export class CacheService {
logger.error('Cache delete error', { key, error });
}
}
/**
* Delete all keys matching the provided pattern (without namespace prefix).
* Uses SCAN to avoid blocking Redis for large keyspaces.
*/
async deletePattern(pattern: string): Promise<void> {
try {
const namespacedPattern = this.prefix + pattern;
let cursor = '0';
do {
const [nextCursor, keys] = await redis.scan(
cursor,
'MATCH',
namespacedPattern,
'COUNT',
100
);
cursor = nextCursor;
if (keys.length > 0) {
await redis.del(...keys);
}
} while (cursor !== '0');
} catch (error) {
logger.error('Cache delete pattern error', { pattern, error });
}
}
}
export const cacheService = new CacheService();