using System.Collections.Generic; using System.Threading.Tasks; using YiSha.Business.Cache.IService; using YiSha.Cache.Factory; using YiSha.Entity.SystemManage; using YiSha.IService.SystemManage; namespace YiSha.Business.Cache.Service { public class AreaCacheService : IAreaCacheService { private IAreaService _areaService; public AreaCacheService(IAreaService areaService) { _areaService = areaService; } public string CacheKey => this.GetType().Name; public async Task> GetList() { var cacheList = CacheFactory.Cache.GetCache>(CacheKey); if (cacheList == null) { var result = await _areaService.GetListPartial(null); CacheFactory.Cache.SetCache(CacheKey, result); return result; } else { return cacheList; } } public bool Remove() { return CacheFactory.Cache.RemoveCache(CacheKey); } } }