using System; using System.Collections.Generic; using System.Threading.Tasks; namespace PhoenixLib.Caching { public interface ICachedRepository { T Get(TKey id); T Get(TKey id, string prefix); T GetOrSet(TKey id, Func fetchDelegate); T GetOrSet(TKey id, Func fetchDelegate, TimeSpan timeToKeepInCache); Task GetOrSetAsync(TKey id, Func> fetchDelegate); Task GetOrSetAsync(TKey id, Func> fetchDelegate, TimeSpan timeToKeepInCache); IReadOnlyList GetValues(IEnumerable keys); IReadOnlyList GetValues(IEnumerable keys, string prefix); void Set(TKey id, T value); void Set(TKey id, T value, TimeSpan timeToKeepInCache); void Set(TKey id, T value, string prefix); void Set(TKey id, T value, string prefix, TimeSpan timeToKeepInCache); Task SetAsync(TKey id, Func> fetchDelegate); Task SetAsync(TKey id, Func> fetchDelegate, TimeSpan timeToKeepInCache); void Remove(TKey id); } }