private void AddAzureCacheForRedis()

in src/Relecloud.Web.CallCenter/Startup.cs [68:87]


        private void AddAzureCacheForRedis(IServiceCollection services, TokenCredential token)
        {
            var redisCacheConnectionString = Configuration["App:RedisCache:ConnectionString"];

            if (!string.IsNullOrWhiteSpace(redisCacheConnectionString))
            {
                services.AddStackExchangeRedisCache(options =>
                {
                    var configurationOptions = ConfigurationOptions.Parse(redisCacheConnectionString);

                    configurationOptions.ConfigureForAzureWithTokenCredentialAsync(token).GetAwaiter().GetResult();

                    options.ConfigurationOptions = configurationOptions;
                });
            }
            else
            {
                services.AddDistributedMemoryCache();
            }
        }