/// <summary> /// Gets all cache keys, optionally matching the provided pattern. /// WARNING: THIS IS A VERY EXPENSIVE OPERATION FOR LARGE CACHES. USE WITH CAUTION. /// </summary> /// <param name="pattern">The search pattern (RegEx). Optional. If not specified, the default of "*" is used to indicate match all.</param> /// <returns>The list of cache keys matching the provided pattern.</returns> public List <string> GetCacheKeys(string pattern = "*") { // Sanitize if (string.IsNullOrWhiteSpace(pattern)) { return(null); } // Get the values var cacheKeys = _memCache.Keys(pattern); if (cacheKeys == null) { return(null); } return(cacheKeys); }
/// <summary> /// Gets all the keys in the cache. /// WARNING: THIS IS A VERY EXPENSIVE OPERATION FOR LARGE CACHES. USE WITH CAUTION. /// </summary> /// <param name="pattern">The regular expression search pattern. If no pattern is provided, default "*" (all) is used.</param> public List <string> Keys(string pattern) { return(_memCache.Keys(pattern)); }