diff --git a/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs b/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs index 3cfe1d27..913ebb10 100644 --- a/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs +++ b/src/EasyCaching.InMemory/Internal/InMemoryCaching.cs @@ -283,7 +283,7 @@ public int RemoveByPattern(string searchKey, SearchKeyPattern searchPattern) public IEnumerable GetAllKeys(string prefix) { return _memory.Values.Where(x => x.Key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && x.ExpiresAt > SystemClock.UtcNow) - .Select(x=> x.Key).ToList(); + .Select(x => x.Key).ToList(); } private static bool FilterByPattern(string key, string searchKey, SearchKeyPattern searchKeyPattern) @@ -314,10 +314,10 @@ public IDictionary> GetAll(IEnumerable keys) public IDictionary> GetAll(string prefix = "") { - var values = string.IsNullOrEmpty(prefix) - ? _memory.Values.Where(x => x.ExpiresAt > SystemClock.UtcNow) + var values = string.IsNullOrEmpty(prefix) + ? _memory.Values.Where(x => x.ExpiresAt > SystemClock.UtcNow) : _memory.Values.Where(x => x.Key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && x.ExpiresAt > SystemClock.UtcNow); - + return values.ToDictionary(k => k.Key, v => new CacheValue(v.GetValue(_options.EnableReadDeepClone), true)); }