using System.Collections.Immutable; namespace Connected.Caching; internal class MemoryCache : Cache, IMemoryCache { public void Merge(ICache cache) { if (cache.Keys() is not ImmutableList keys) return; foreach (var key in keys) { if (cache.Keys(key) is not ImmutableList entryKeys) continue; foreach (var entryKey in entryKeys) { if (cache.Get(key, entryKey) is IEntry entry) CopyTo(key, entryKey, entry); } } } }