refactor: unify image cache contract

This commit is contained in:
Dariusz L
2026-08-13 07:18:12 +02:00
parent c461da1481
commit ec313f1ce6
10 changed files with 86 additions and 29 deletions
+9 -6
View File
@@ -4,18 +4,21 @@ export class ImageCache {
constructor() {
this.cache = new Map();
}
set(key, imageData) {
log.info("Caching image data for key:", key);
this.cache.set(key, imageData);
set(key, image) {
log.info("Caching image for key:", key);
this.cache.set(key, image);
}
get(key) {
const data = this.cache.get(key);
log.debug("Retrieved cached data for key:", key, !!data);
return data;
const image = this.cache.get(key);
log.debug("Retrieved cached image for key:", key, !!image);
return image;
}
has(key) {
return this.cache.has(key);
}
delete(key) {
return this.cache.delete(key);
}
clear() {
log.info("Clearing image cache");
this.cache.clear();