using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Distributed; namespace EntrustSettle.Common.Caches; /// /// 缓存抽象接口,基于IDistributedCache封装 /// public interface ICaching { public IDistributedCache Cache { get; } void AddCacheKey(string cacheKey); Task AddCacheKeyAsync(string cacheKey); void DelByPattern(string key); Task DelByPatternAsync(string key); void DelCacheKey(string cacheKey); Task DelCacheKeyAsync(string cacheKey); bool Exists(string cacheKey); Task ExistsAsync(string cacheKey); List GetAllCacheKeys(); Task> GetAllCacheKeysAsync(); T Get(string cacheKey); Task GetAsync(string cacheKey); object Get(Type type, string cacheKey); Task GetAsync(Type type, string cacheKey); string GetString(string cacheKey); Task GetStringAsync(string cacheKey); void Remove(string key); Task RemoveAsync(string key); void RemoveAll(); Task RemoveAllAsync(); void Set(string cacheKey, T value, TimeSpan? expire = null); Task SetAsync(string cacheKey, T value); Task SetAsync(string cacheKey, T value, TimeSpan expire); void SetPermanent(string cacheKey, T value); Task SetPermanentAsync(string cacheKey, T value); void SetString(string cacheKey, string value, TimeSpan? expire = null); Task SetStringAsync(string cacheKey, string value); Task SetStringAsync(string cacheKey, string value, TimeSpan expire); Task DelByParentKeyAsync(string key); }