diff --git a/zero/Media/MediaMetadataCache.cs b/zero/Media/MediaMetadataCache.cs
index 2350d52c..1407dfc5 100644
--- a/zero/Media/MediaMetadataCache.cs
+++ b/zero/Media/MediaMetadataCache.cs
@@ -2,59 +2,10 @@
namespace zero.Media;
-public class MediaMetadataCache : IMediaMetadataCache
+public sealed class MediaMetadataCache
{
- private const string PREFIX = "zero/media/";
-
- protected IMemoryCache Cache { get; set; }
-
-
- public MediaMetadataCache(IMemoryCache cache)
+ public IMemoryCache Cache { get; internal set; } = new MemoryCache(new MemoryCacheOptions
{
- Cache = cache;
- }
-
-
- ///
- public bool TryGet(string id, out CachedMedia media)
- {
- MediaCacheEntry entry = Cache.Get(Key(id));
-
- media = entry != null ? CachedMedia.Create(entry) : null;
- return entry != null;
- }
-
-
- ///
- public void Set(Media media)
- {
- MediaCacheEntry entry = MediaCacheEntry.Create(media);
- Cache.Set(Key(media.Id), entry, new MemoryCacheEntryOptions()
- {
- SlidingExpiration = TimeSpan.FromSeconds(60 * 60 * 24)
- });
- }
-
-
- ///
- /// Generate cache key from media Id
- ///
- static string Key(string id)
- {
- return PREFIX + id;
- }
+ SizeLimit = 1000
+ });
}
-
-
-public interface IMediaMetadataCache
-{
- ///
- /// Get a cached and reduced version of a media entity
- ///
- bool TryGet(string id, out CachedMedia media);
-
- ///
- /// Store a media entity in cache
- ///
- void Set(Media media);
-}
\ No newline at end of file