/// <summary> /// Determines whether an item with the given cache key is in the cache. /// </summary> /// <param name="key">Cache Key</param> /// <param name="partitionName"> /// Optional value for the name of a partition in the application cache. Partitions can be a good way to categorize or group /// certain types of items in the cache together. /// </param> /// <returns>Whether or not there is an item in the cache with that key and partition name</returns> public async Task <bool> ContainsAsync(string key, string partitionName = "") { if (string.IsNullOrEmpty(key)) { return(false); } if (string.IsNullOrEmpty(partitionName)) { return(await _redisDatabase.KeyExistsAsync(key).ConfigureAwait(false)); } var partitionKey = ComposePartitionKey(partitionName); return(await _redisDatabase.HashExistsAsync(partitionKey, key).ConfigureAwait(false)); }