Replies: 2 comments 13 replies
-
I wasn't aware we'd created that regression. Sorry! Rather than adding an option I'd like to see if we can have another crack at the caching to allow a |
Beta Was this translation helpful? Give feedback.
13 replies
-
It might be a good idea to add an example of the NullImageCache to the documentation. For anyone looking for it, if you have nullability enabled in your project the NullImageCache would be: public class NullImageCache : IImageCache
{
public Task<IImageCacheResolver?> GetAsync(string key) => Task.FromResult<IImageCacheResolver?>(null);
public Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata) => Task.CompletedTask;
} Without nullability: public class NullImageCache : IImageCache
{
public Task<IImageCacheResolver> GetAsync(string key) => Task.FromResult<IImageCacheResolver>(null);
public Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata) => Task.CompletedTask;
} |
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
-
In older versions of the ImageSharp.Web library, it was possible to effectively disable the caching logic by supplying a dummy IImageCache implementation like this:
We leverage this in our application as we already have a custom caching system applied earlier in the request processing pipeline and thus don't need ImageSharp to add any additional caching. As of version 1.0.3, this technique is no longer possible because the ImageSharpMiddleware was changed to always operate by writing into the cache and then immediately reading back out of the cache again (in commit 2632fc0).
I'd like to add a
DisableCaching
option to theImageSharpMiddlewareOptions
that gives consumers an officially supported way of opting out of the caching logic. Does this seem like a reasonable feature to add, and if so, would anyone object to me putting together a PR?Beta Was this translation helpful? Give feedback.
All reactions