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.
24 lines
475 B
24 lines
475 B
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);
|
|
}
|
|
}
|
|
}
|
|
} |