Improved and more granular cache invalidation #409
Unanswered
enkelmedia
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
First of all, thank you very much for one of the best open source projects in the .NET ecosystem! I'm truly impressed!
Personally I only use ImageSharp as a dependency to Umbraco CMS, and one thing that has been bugging me for a long time is the "missmatch" between the media library in Umbraco and the cached files from ImageSharp.Web. For example, when removing a file in the Media-section of Umbraco there is no way to know which cached files on disk to remove.
I know that there are "time based expiration" for the cached files but it's not a great option. Most of the caches images are generated during launch of the website, if we use time based expiration (say 30days) - the server would have to re-generate almost all the files at the same time when 30 days have passed and the cached files are cleared.
I say this idea: Ihttps://github.com/SixLabors/ImageSharp.Web/discussions/380 which would be a huge leap forward.
But, adding to this, we use custom
IImageProviders that fetch images from external sources (like the good old "Remote Image" from Image Processor). For example a "Listing" with 30 images. When the listing is removed, we know which listing that is removed and we can remove the "source images" but we have no way to remote the caches images.I've been thinking about this for a long time without coming up with a "great" solution, I've been thinking about things like:
But, today it struck me that a quite simple thing could solve a lot of the "problems" that we have.
If one could pass some kind of custom
identifier(orhash) in the URL to the generated image, e.g.And ImageSharp.Web could use that hash to create a known folder-structure for the cached images. E.g.
It would be possible for an application to remove the
/a/b/c/abc123/-folder e.g. when something in the Umbraco media-library is removed or when a "listing" is removed from our app. And technically, it does not matter if thehashidentifies a unique image (like it would for Umbraco media) or a "listing" in our case - any associated cached image could safely be removed.Not sure if people like this idea? I would be willing to help out with both exploring the specification and to work in the implementation.
All reactions