public async Task <DataEncryptionKeyProperties> GetOrAddByNameLinkUriAsync(
            Uri dekNameLinkUri,
            string databaseId,
            Func <CosmosDiagnosticsContext, CancellationToken, Task <DataEncryptionKeyProperties> > fetcher,
            CosmosDiagnosticsContext diagnosticsContext,
            CancellationToken cancellationToken)
        {
            CachedDekProperties cachedDekProperties = await this.DekPropertiesByNameLinkUriCache.GetAsync(
                dekNameLinkUri,
                null,
                () => this.FetchAsync(fetcher, databaseId, diagnosticsContext, cancellationToken),
                cancellationToken);

            if (cachedDekProperties.ServerPropertiesExpiryUtc <= DateTime.UtcNow)
            {
                cachedDekProperties = await this.DekPropertiesByNameLinkUriCache.GetAsync(
                    dekNameLinkUri,
                    null,
                    () => this.FetchAsync(fetcher, databaseId, diagnosticsContext, cancellationToken),
                    cancellationToken,
                    forceRefresh : true);
            }

            this.DekPropertiesByRidSelfLinkCache.Set(cachedDekProperties.ServerProperties.SelfLink, cachedDekProperties);
            return(cachedDekProperties.ServerProperties);
        }
        public void Set(string databaseId, Uri dekNameLinkUri, DataEncryptionKeyProperties dekProperties)
        {
            CachedDekProperties cachedDekProperties = new CachedDekProperties(databaseId, dekProperties, DateTime.UtcNow + this.dekPropertiesTimeToLive);

            this.DekPropertiesByNameLinkUriCache.Set(dekNameLinkUri, cachedDekProperties);
            this.DekPropertiesByRidSelfLinkCache.Set(dekProperties.SelfLink, cachedDekProperties);
        }
        public async Task RemoveAsync(Uri linkUri)
        {
            CachedDekProperties cachedDekProperties = await this.DekPropertiesByNameLinkUriCache.RemoveAsync(linkUri);

            if (cachedDekProperties != null)
            {
                this.DekPropertiesByRidSelfLinkCache.Remove(cachedDekProperties.ServerProperties.SelfLink);
                this.RawDekByRidSelfLinkCache.Remove(cachedDekProperties.ServerProperties.SelfLink);
            }
        }