Skip to content

Commit 1a00c51

Browse files
committedAug 10, 2024
More cleaning.
1 parent 896f128 commit 1a00c51

File tree

2 files changed

+2
-71
lines changed

2 files changed

+2
-71
lines changed
 

‎src/EasyCaching.Core/DistributedLock/RefCounter.cs

Lines changed: 0 additions & 59 deletions
This file was deleted.

‎src/EasyCaching.InMemory/Internal/InMemoryCaching.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,7 @@ private static bool FilterByPattern(string key, string searchKey, SearchKeyPatte
305305

306306
public IDictionary<string, CacheValue<T>> GetAll<T>(IEnumerable<string> keys)
307307
{
308-
var map = new Dictionary<string, CacheValue<T>>();
309-
foreach (string key in keys)
310-
map[key] = Get<T>(key);
311-
312-
return map;
308+
return keys.ToDictionary(key => key, key => Get<T>(key));
313309
}
314310

315311
public IDictionary<string, CacheValue<T>> GetAll<T>(string prefix = "")
@@ -323,13 +319,7 @@ public IDictionary<string, CacheValue<T>> GetAll<T>(string prefix = "")
323319

324320
public int SetAll<T>(IDictionary<string, T> values, TimeSpan? expiresIn = null)
325321
{
326-
if (values == null || values.Count == 0) return 0;
327-
328-
var list = new List<bool>();
329-
330-
foreach (var entry in values) list.Add(Set(entry.Key, entry.Value, expiresIn));
331-
332-
return list.Count(r => r);
322+
return values?.Count(entry => Set(entry.Key, entry.Value, expiresIn)) ?? 0;
333323
}
334324

335325
public bool Replace<T>(string key, T value, TimeSpan? expiresIn = null)

0 commit comments

Comments
 (0)