public void Set(DecryptIdentifier identifier, byte[] item)
        {
            var cacheKey = _cacheKeyGenerator.Generate(identifier);

            var options = _distributedCacheEntryOptionsFactory.Create(CacheItemType.Decrypt);

            _distributedCache.Set(cacheKey, item, options);
        }
        public byte[] Get(DecryptIdentifier identifier)
        {
            var cacheKey = _cacheKeyGenerator.Generate(identifier);

            var cacheItem = _distributedCache.Get(cacheKey);

            return(cacheItem);
        }
        public byte[] Decrypt(byte[] ciphertextBlob, Dictionary <string, string> encryptionContext)
        {
            var identifier = new DecryptIdentifier(ciphertextBlob, encryptionContext);

            var cacheItem = _decryptKeyCache.Get(identifier);

            if (cacheItem is null)
            {
                var item = _keyManagementService.Decrypt(ciphertextBlob, encryptionContext);

                _decryptKeyCache.Set(identifier, item);

                return(item);
            }

            return(cacheItem);
        }