简体   繁体   English

隐性核心Blob存储缓存

[英]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.

相关问题 Azure Blob存储-分块文件上传-跨回发缓存数据 - Azure blob storage - chunked file upload - caching data across postbacks Stream 视频来自 Azure blob 存储和 ASP.NET 核心 3 - Stream videos from Azure blob storage and ASP.NET Core 3 上传/获取 Blob - 在 .NET 核心中使用 Azure 存储帐户创建容器 - Upload/Get Blob - Create Container with Azure Storage Account in .NET Core 使用 .Net Core API 从 Azure Blob 存储异步流式传输视频 - Asynchronously Streaming Video with .Net Core API from Azure Blob Storage 不能与.Net Core App中的Azure Blob存储一起使用 - Can't work with Azure Blob Storage from .Net Core App 如何在 ASP.NET Core 应用程序中显示来自 Azure Blob 存储帐户的图像? - How to I display an image from my Azure Blob Storage Account in my ASP.NET Core Application? 如何从 C# 核心中的 azure blob 存储读取所有文件 - How read all files from azure blob storage in C# Core 将 ResponseStream 上传到 Blob 存储 - Uploading ResponseStream to Blob Storage 上传到Azure Blob存储 - upload to azure blob storage 能够在执行后恢复(将文件更新到 blob 存储)和(通过 EF Core 添加/更新数据库) - Ability to revert (update file to blob storage) and (db add/update via EF Core) after execution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM