Especially for buffering data with limited validity (such as e.g. access tokens), the in-memory caching can be useful. This snippet shows the likely most simple solution.
Ensure that following Nuget packes are installed:
Microsoft.NET.Sdk.Functions
(tested with 3.0.13)System.Runtime.Caching
(tested with 5.0.0)Then you can adapt the function CacheDemoFunc
in your Function App.