fix: remove cache.has function

This commit is contained in:
max_richter 2023-07-26 16:19:28 +02:00
parent 2fa46d65ae
commit c61054990b
2 changed files with 3 additions and 6 deletions

View File

@ -24,10 +24,6 @@ export function get(id: string) {
return cache.get(id);
}
export function has(id: string) {
return cache.has(id);
}
export function set(id: string, content: any) {
return cache.set(id, content);
}

View File

@ -108,8 +108,9 @@ export const handler = async (
}
const imageId = `${imageUrl}.${params.width}.${params.height}`;
if (await cache.has(imageId)) {
return (await (await cache.get(imageId)!)).clone();
const cachedResponse = await cache.get(imageId);
if (cachedResponse) {
return (await cachedResponse).clone();
}
const remoteImage = await getRemoteImage(imageUrl);