public void Clear(string prefix = null) { if (string.IsNullOrWhiteSpace(prefix)) { _cache.Clear(); } else { IDictionaryEnumerator enumerator = _cache.GetEnumerator(); var fullPrefix = InternalCachePrefix + prefix; while (enumerator.MoveNext()) { var key = enumerator.Key.ToString(); if (key.StartsWith(fullPrefix, StringComparison.OrdinalIgnoreCase)) { _cache.Remove(key); } } } }
/// <summary> /// Clear the cached sighting details model /// </summary> /// <param name="userName"></param> public void ClearCachedSightingDetailsModel(string userName) { string key = GetCacheKey(SightingDetailsKeyPrefix, userName); _cache.Remove(key); }