首页 > 解决方案 > 使用 Azure Redis 在逻辑应用中进行缓存

问题描述

我正在分析 Biztalk 应用程序到逻辑应用程序的迁移。因此,目前我在 SQL Server 中几乎没有需要在逻辑应用程序中使用的数据映射表。所以我可能不得不寻找不同的存储选项,例如 sql server、azure storage 等。我想尝试 Azure redis 缓存在逻辑应用程序中的工作方式。我搜索了很多,但找不到包含我需要遵循的整个过程或步骤/代码的示例。任何人都可以分享我在逻辑应用程序中使用 Redis 需要遵循的教程/步骤。

标签: c#azureredisazure-logic-apps

解决方案


逻辑应用程序中没有可用于 Redis 缓存的直接连接器。您需要通过Azure Function.

string cstring = System.Configuration.ConfigurationManager.ConnectionStrings["SampleLogicAppState"].ConnectionString;
     ConnectionMultiplexer LogicAppStatusConnection = ConnectionMultiplexer.Connect(cstring);

     System.Net.Http.Headers.HttpRequestHeaders reqHeaders = req.Headers;
     string LogicApp = reqHeaders.Contains("LogicApp") ? reqHeaders.GetValues("LogicApp").First() : null;
     string ID = reqHeaders.Contains("ID") ? reqHeaders.GetValues("ID").First() : null;
     string Status = reqHeaders.Contains("Status") ? reqHeaders.GetValues("Status").First() : null;

    string cacheKey = LogicApp + "+" + ID;
     IDatabase LogicAppStatusCache = LogicAppStatusConnection.GetDatabase();

推荐阅读