in src/CosmosCache.cs [284:312]
public async Task RemoveAsync(string key, CancellationToken token = default(CancellationToken))
{
token.ThrowIfCancellationRequested();
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
await this.ConnectAsync(token).ConfigureAwait(false);
try
{
ItemResponse<CosmosCacheSession> deleteCacheSessionResponse = await this.cosmosContainer.DeleteItemAsync<CosmosCacheSession>(
partitionKey: new PartitionKey(key),
id: key,
requestOptions: new ItemRequestOptions()
{
EnableContentResponseOnWrite = false,
},
cancellationToken: token).ConfigureAwait(false);
this.options.DiagnosticsHandler?.Invoke(deleteCacheSessionResponse.Diagnostics);
}
catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
{
// do nothing
this.options.DiagnosticsHandler?.Invoke(ex.Diagnostics);
}
}