using Microsoft.Extensions.DependencyInjection; using System; namespace Bowin.Common.Cache { public interface ICacheProvider { void Config(IServiceCollection service); object Add(string key, object entry); object Add(string key, object entry, DateTime utcExpiry); object Get(string key); void Remove(string key); void Set(string key, object entry); void Set(string key, object entry, DateTime utcExpiry); } public static class CacheProvider { public static void Config(IServiceCollection service) where T : ICacheProvider, new() { new T().Config(service); } } }