You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Caching/MemoryCache.cs

24 lines
475 B

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