Updated memory cache fields.
This commit is contained in:
@@ -5,6 +5,10 @@ namespace Harmonia.Core.Caching;
|
|||||||
|
|
||||||
public class AudioImageMemoryCache(IAudioImageExtractor audioImageExtractor) : MemoryCache<Song, SongPictureInfo>, IAudioImageCache
|
public class AudioImageMemoryCache(IAudioImageExtractor audioImageExtractor) : MemoryCache<Song, SongPictureInfo>, IAudioImageCache
|
||||||
{
|
{
|
||||||
|
protected override long? SizeLimit => 2000000000;
|
||||||
|
protected override double CompactionPercentage => 0.2;
|
||||||
|
protected override TimeSpan SlidingExpiration => TimeSpan.FromSeconds(600);
|
||||||
|
|
||||||
protected override object? GetKey(Song key)
|
protected override object? GetKey(Song key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(key.ImageHash) == false)
|
if (string.IsNullOrWhiteSpace(key.ImageHash) == false)
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ public abstract class MemoryCache<TKey, TValue> : Cache<TKey, TValue> where TKey
|
|||||||
{
|
{
|
||||||
private readonly IMemoryCache _memoryCache;
|
private readonly IMemoryCache _memoryCache;
|
||||||
|
|
||||||
protected virtual long? SizeLimit => 2000000000;
|
protected abstract long? SizeLimit { get; }
|
||||||
protected virtual double CompactionPercentage => 0.2;
|
protected abstract double CompactionPercentage { get; }
|
||||||
protected virtual TimeSpan SlidingExpiration => TimeSpan.FromSeconds(600);
|
protected abstract TimeSpan SlidingExpiration { get; }
|
||||||
|
|
||||||
public MemoryCache()
|
public MemoryCache()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user