• <legend id='e4f5S'><style id='e4f5S'><dir id='e4f5S'><q id='e4f5S'></q></dir></style></legend>
  • <i id='e4f5S'><tr id='e4f5S'><dt id='e4f5S'><q id='e4f5S'><span id='e4f5S'><b id='e4f5S'><form id='e4f5S'><ins id='e4f5S'></ins><ul id='e4f5S'></ul><sub id='e4f5S'></sub></form><legend id='e4f5S'></legend><bdo id='e4f5S'><pre id='e4f5S'><center id='e4f5S'></center></pre></bdo></b><th id='e4f5S'></th></span></q></dt></tr></i><div id='e4f5S'><tfoot id='e4f5S'></tfoot><dl id='e4f5S'><fieldset id='e4f5S'></fieldset></dl></div>

  • <small id='e4f5S'></small><noframes id='e4f5S'>

    <tfoot id='e4f5S'></tfoot>

        • <bdo id='e4f5S'></bdo><ul id='e4f5S'></ul>
      1. Azure 函数和缓存

        Azure Functions and Caching(Azure 函数和缓存)

        <small id='88f3E'></small><noframes id='88f3E'>

        • <i id='88f3E'><tr id='88f3E'><dt id='88f3E'><q id='88f3E'><span id='88f3E'><b id='88f3E'><form id='88f3E'><ins id='88f3E'></ins><ul id='88f3E'></ul><sub id='88f3E'></sub></form><legend id='88f3E'></legend><bdo id='88f3E'><pre id='88f3E'><center id='88f3E'></center></pre></bdo></b><th id='88f3E'></th></span></q></dt></tr></i><div id='88f3E'><tfoot id='88f3E'></tfoot><dl id='88f3E'><fieldset id='88f3E'></fieldset></dl></div>
        • <legend id='88f3E'><style id='88f3E'><dir id='88f3E'><q id='88f3E'></q></dir></style></legend>
            <tbody id='88f3E'></tbody>
              • <bdo id='88f3E'></bdo><ul id='88f3E'></ul>
                <tfoot id='88f3E'></tfoot>

                  本文介绍了Azure 函数和缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我们计划开发一个 Azure 函数,其输入触发器是服务总线消息,输出是 blob 存储.服务总线消息将包含一个图像 url,该函数会将图像大小调整为预定义的分辨率,并将上传到 azure blob 存储.

                  We are planning to develop an Azure function for which the input trigger is a service bus message and the output will be blob storage. The service bus message will contain a image url and the function will resize the image to a predefined resolution and will upload to azure blob storage.

                  图像应调整大小的分辨率存储在数据库中,Azure 函数需要调用数据库以了解输入消息中图像应使用的分辨率.分辨率实际上是根据输入消息的来源配置的主数据.

                  The resolution to which the image should be resized is stored in the database and the Azure function needs to make a call to database to get to know the resolution that is supposed to be used for the image in the input message. The resolution would actually be a master data configured based on the source of the input message.

                  进行数据库调用将是一个昂贵的调用,因为每次调用都必须访问数据库.有什么方法可以缓存数据并在不调用数据库的情况下使用它.就像在内存缓存中一样?

                  Making a database call would be a expensive call as it would have to go to the database for each call. Is there any way to cache the data and use it without calling the database. Like in memory caching?

                  推荐答案

                  您可以自由使用在其他 .NET 应用程序中使用的常用方法:

                  You are free to use the usual approaches that you would use in other .NET applications:

                  • 您可以将其缓存在内存中.最简单的方法就是声明一个静态字典并将数据库值放入其中(如果需要,使用并发字典).缓存的值将被重复用于在同一实例上运行的所有后续函数执行.如果一个实例空闲 5 分钟,或者如果 App 扩展到一个额外的实例,您将不得不再次读取数据库;

                  • You can cache it in memory. The easiest way is just to declare a static dictionary and put database values inside (use concurrent dictionary if needed). The cached values will be reused for all subsequent Function executions which run on the same instance. If an instance gets idle for 5 minutes, or if App scales out to an extra instance, you will have to read the database again;

                  您可以使用分布式缓存,例如Redis,通过使用其函数代码中的 SDK.可能会更好一些,因为您保留了 Functions 的无状态特性,但可能会花费更多.表存储是 Redis 的可行替代方案,但 API 更有限.

                  You can use distributed cache, e.g. Redis, by using its SDK from Function code. Might be a bit nicer, since you keep the stateless nature of Functions, but might cost a bit more. Table Storage is a viable alternative to Redis, but with more limited API.

                  Azure Functions 本身没有缓存"功能,无需任何额外代码即可使用.

                  There's no "caching" feature of Azure Functions themselves, that would be ready to use without any extra code.

                  这篇关于Azure 函数和缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                  set equality in linq(在 linq 中设置相等)
                  HashSet conversion to List(HashSet 转换为 List)
                  How to set timeout for webBrowser navigate event(如何为 webBrowser 导航事件设置超时)
                  Test whether two IEnumerablelt;Tgt; have the same values with the same frequencies(测试两个IEnumerablelt;Tgt;具有相同频率的相同值)
                  How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)
                    <tbody id='UV1AE'></tbody>
                  <legend id='UV1AE'><style id='UV1AE'><dir id='UV1AE'><q id='UV1AE'></q></dir></style></legend>

                    1. <i id='UV1AE'><tr id='UV1AE'><dt id='UV1AE'><q id='UV1AE'><span id='UV1AE'><b id='UV1AE'><form id='UV1AE'><ins id='UV1AE'></ins><ul id='UV1AE'></ul><sub id='UV1AE'></sub></form><legend id='UV1AE'></legend><bdo id='UV1AE'><pre id='UV1AE'><center id='UV1AE'></center></pre></bdo></b><th id='UV1AE'></th></span></q></dt></tr></i><div id='UV1AE'><tfoot id='UV1AE'></tfoot><dl id='UV1AE'><fieldset id='UV1AE'></fieldset></dl></div>
                    2. <small id='UV1AE'></small><noframes id='UV1AE'>

                          <tfoot id='UV1AE'></tfoot>
                            <bdo id='UV1AE'></bdo><ul id='UV1AE'></ul>