Exemplo n.º 1
0
        public async Task <Secret> GetSecretAsync(string secretKey, bool useCache = true)
        {
            var secret = string.Empty;

            if (useCache)
            {
                if (await _cache.ExistsAsync(secretKey))
                {
                    secret = await _cache.GetAsync(secretKey);

                    return(new Secret(secretKey, secret));
                }
            }

            secret = (await _keyVaultClient.GetSecretAsync(_vaultUri, secretKey)).Value;
            if (useCache)
            {
                await _cache.SetAsync(secretKey, secret);
            }

            return(new Secret(secretKey, secret));
        }