Maybe it’s something in UI, but many times I watch pictures (not even videos, they are their own can of worms), and want to save them, it shows me that I’m downloading them again although they are cached in whatever app I see them from.
Like this link with a happy dog: i.pinimg.com/…/711e52f1d6c7ead78f4380214f68c259.j…
I see it in high rez in my browser, I can zoom in, and I can’t tell any difference from a copy that I can download, but it’s still, well, another download if I want to save it, and not a move from cache to my download folder, another request to the server, another waste of traffic.
Is there some rule of sandboxing for everything you load that I don’t know about? In cases like our fediverse, I wouldn’t like to cause double load when I already have the picture I want. Can I cut it down with some plugin in mobile Firefox?
zoostation@lemmy.world 1 week ago
It’s simpler code to re-download the file than retrieve what cached version may or may not exist in memory or on disk. Developers often like to keep code simple at the expense of some kinds of efficiency, like this.
An image is usually small enough to be downloaded in no time on a fast connection, which is what developers usually have and don’t stop to think that others might not have.
A video is probably being streamed so earlier segments may no longer be present locally.
gazby@lemmy.dbzer0.com 1 week ago
If it were difficult or time consuming to lookup or fetch items from the cache, it’s not a very effective cache 😬
zoostation@lemmy.world 1 week ago
It’s more about keeping the downloads code independent from the cache code. Once one depends on the other, you can’t change either one without considering the other. Minimizing dependencies is the kind of complexity it’s good to avoid.
spankmonkey@lemmy.world 1 week ago
Easy for the browser to lookup and fetch, not necessarily the process of writing permanently to the disk.
FourPacketsOfPeanuts@lemmy.world 1 week ago
This seems incredible
There would already have to be a data layer that serves the main web page renderer. That layer would already have to handle looking in the cache or making an http request in event of a cache miss. It would seem almost trivial for a UI operation like ‘save to disk’ to simply call that layer obtain the data…
For a few hundred K image I can understand why some might not bother, but I’ve seen this behaviour where a browser already has an MP4 cached (such that it can replay any part of it without subsequent http traffic) and yet it still makes a new request when saving. It’s weird to be honest…
undefined@lemmy.hogru.ch 1 week ago
Maybe I’m not understanding the question but typically a CDN will have HTTP headers to signal to the browser to cache the asset (image). I can’t imagine Pinterest isn’t using a CDN, so if it’s re-fetched over the network that sounds like a browser problem more than a developer one.
zoostation@lemmy.world 1 week ago
That’s right, I was referring to the browser/client developer. The browser cache is treated as ephemeral storage so it’s not a safe assumption that a previously downloaded file is still there.