Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private Uri GetDocumentUri(string key)
  2. {
  3. return UriFactory.CreateDocumentUri(
  4. _options.DatabaseName,
  5. _options.CollectionName,
  6. key);
  7. }
  8.  
  9. public async Task<byte[]> GetAsync(string key, CancellationToken token)
  10. {
  11. var uri = this.GetDocumentUri(key);
  12.  
  13. try
  14. {
  15. var result = await _client
  16. .ReadDocumentAsync<CosmosDbCacheItem>(uri, new RequestOptions() { });
  17.  
  18. return result.Document.ToByteContent();
  19. }
  20. catch (DocumentClientException)
  21. {
  22. return null;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement