Replies: 1 comment
-
Ok... So yeah, you cannot currently set the cached max age per image or provider only the max age that is sent to the browser headers collection. However, I think it's reasonable to request that the max age override affects both browser and cache values. We could add a property to the options that chooses whether we look at the global Then you could set individual providers to cache images for individual times both in the browser and cache. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I recently upgraded to version 1.0.1 of the ImageSharp.Web nuget. I have two custom Image Providers (ProviderA, ProviderB).
Both ORIGINAL images I am grabbing updates the image every 5 seconds or so (think security cams).
I am trying to figure out a way to set the max cache for each provider (one for 10 seconds, one for 1 min as an example). Here is the code I am using in ProviderA:
I keep getting the following in my debug output when refreshing after 10 seconds:
SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware: Information: The image 'https://BLAH/BLAH.jpg?format=jpg&width=360' was not modified
With this code, I would expect the image to update every 10 seconds, but it is not. The image only gets updated when I restart the app.
I was able to get the image to update every 10 seconds by applying:
options.CacheMaxAge = TimeSpan.FromSeconds(10);
Here is my ConfigureServices
So with that said. Can I somehow apply the CacheMaxAge per provider in the ConfigureService? Or am I doing something wrong within the GetMetaDataAsync method?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions