[英]dotent core blob storage caching
I have image processor app, for processing image and getting it from azure blob storage. 我有图像处理器应用程序,用于处理图像并从天蓝色斑点存储中获取图像。 In this moment my blob storage service is returning absolute url to image of blob return redirect to this url.
在这一刻,我的Blob存储服务正在将绝对URL返回到Blob图片,并将重定向重定向到此URL。 For example:
例如:
[Route("/blob-storage/{imageName}")]
[HttpGet]
public async Task<IActionResult> GetImage(string imageName, ImageSize size)
{
var imageUrl = await this.ImageProcessorFacade.GetImageUrl(imageName, size);
return Redirect(imageUrl);
}
Now I want to caching this returned image. 现在,我想缓存此返回的图像。 Yes, exists
ResponseCache
attribute, but It doesn't me work with redirect and I thing that it is bad way to solving this problem. 是的,存在
ResponseCache
属性,但是我不能使用重定向,我认为这是解决此问题的不好方法。 For get image, I call for example this: http://localhost/blob-storage/test.jpeg?size...
And response is redirect to blob.windows.net/...
etc. 为了获取图像,我将其命名为:
http://localhost/blob-storage/test.jpeg?size...
并将响应重定向到blob.windows.net/...
等。
Is there way, how to cache it? 有没有办法,如何缓存呢? Thank you for your time!
感谢您的时间!
I want to caching this returned image.
我想缓存此返回的图像。 Yes, exists ResponseCache attribute, but It doesn't me work with redirect and I thing that it is bad way to solving this problem.
是的,存在ResponseCache属性,但是我不能使用重定向,我认为这是解决此问题的不好方法。 For get image, I call for example this: http://localhost/blob-storage/test.jpeg?size ... And response is redirect to blob.windows.net/... etc.
为了获取图像,我称其为: http://localhost/blob-storage/test.jpeg?size ...然后响应被重定向到blob.windows.net / ...等。
You call Redirect() method in your controller action to redirect to a specified URL, the HTTP Location header field will be returned in response. 您在控制器操作中调用Redirect()方法以重定向到指定的URL,将作为响应返回HTTP Location标头字段。 And then the user agent (eg a web browser) that is invited by a response with 3xx code will make a second request to the new URL specified in the location field, which happens on web browser side, you could not append or modify cache-related headers to response.
然后,带有3xx代码的响应所邀请的用户代理(例如Web浏览器)将再次请求在location字段中指定的新URL,这种情况发生在Web浏览器端,您无法添加或修改缓存-与响应相关的标题。
If you'd like to lower latency and faster delivery the images that stored in Azure blob storage, you could try to use the CDN . 如果您想降低延迟并更快地交付存储在Azure blob存储中的图像,则可以尝试使用CDN 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.