Adjusted cache to allow for throttling and locking.

This commit is contained in:
2025-02-26 23:10:36 -05:00
parent 6835431d1e
commit c1a7d23096
5 changed files with 89 additions and 31 deletions

View File

@@ -6,19 +6,12 @@ public abstract class MemoryCache<TKey, TValue> : Cache<TKey, TValue> where TKey
{
private readonly IMemoryCache _memoryCache;
protected abstract long? SizeLimit { get; }
protected abstract double CompactionPercentage { get; }
protected abstract MemoryCacheOptions Options { get; }
protected abstract TimeSpan SlidingExpiration { get; }
public MemoryCache()
{
MemoryCacheOptions memoryCacheOptions = new()
{
SizeLimit = SizeLimit,
CompactionPercentage = CompactionPercentage
};
_memoryCache = new MemoryCache(memoryCacheOptions);
_memoryCache = new MemoryCache(Options);
}
protected override TValue? TryGetValue(object key)