joelshepherd/tabliss

Unsplash plugin unnecessary to useRotatingCache?

Opened this issue · 0 comments

nc7s commented

A recent memory report of my Firefox showed that the extension process is holding to over 200MB of images, basically all unsplash.com, each around 2MB, meaning over 100 images. The only extension that loads them is Tabliss.

This part came across when examining the source:

const item = useRotatingCache(
() => {
loader.push();
return fetchImages(data).finally(loader.pop);
},
{ cache, setCache },
data.paused ? Number.MAX_SAFE_INTEGER : data.timeout * 1000,
[data.by, data.collections, data.featured, data.search, data.topics],
);

I'm not sure why it's necessary to cache them (in memory) on top of the browser cache. Unsplash sends a Cache-Control header with max-age=31536000, or one year. Frequent enough loads (15 min in my case, 1 hour/day/week as longer options) should be enough to prevent them from being evicted, so even a "naive" request would be from local cache.