且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于 Azure 功能的身份验证令牌缓存

更新时间:2023-12-03 12:49:22

这里有几个选项,按工作量递增的顺序排列

Here a few options, in increasing order of effort

  1. 使用静态成员将令牌存储在内存中,并在必要时懒惰地进行身份验证过程.绝对不能保证这会多久为您节省身份验证步骤 - 它会根据您的功能运行频率、不同机器的数量等而有很大差异.

  1. Use a static member to store the token in memory, and lazily do the authentication process when necessary. There are absolutely no guarantees about how often this will save you the authentication step - it will vary wildly depending on how often your function is running, on how many different machines, etc.

利用为函数提供的临时文件系统存储.您可以在 %TEMP% 上读取/写入文件.

Make use of the temporary filesystem storage provided to functions. You can read/write files on %TEMP%.

使用持久化的外部存储,例如数据库、redis 缓存等

Use a persistent external store such as a database, redis cache, etc.

请注意,我列出这些选项时并未考虑您是否对令牌的持久性有额外的安全要求.

Please note that I'm listing these options without considering whether you have additional security requirements regarding the persistence of the token.