Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Uri GetDocumentUri(string key)
- {
- return UriFactory.CreateDocumentUri(
- _options.DatabaseName,
- _options.CollectionName,
- key);
- }
- public async Task<byte[]> GetAsync(string key, CancellationToken token)
- {
- var uri = this.GetDocumentUri(key);
- try
- {
- var result = await _client
- .ReadDocumentAsync<CosmosDbCacheItem>(uri, new RequestOptions() { });
- return result.Document.ToByteContent();
- }
- catch (DocumentClientException)
- {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement