1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- 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 MenuAuthorizeCacheService : IMenuAuthorizeCacheService<MenuAuthorizeEntity>
- {
- private IMenuAuthorizeService _menuAuthorizeService;
- public MenuAuthorizeCacheService(IMenuAuthorizeService menuAuthorizeService)
- {
- _menuAuthorizeService = menuAuthorizeService;
- }
- public string CacheKey => this.GetType().Name;
- public async Task<List<MenuAuthorizeEntity>> GetList()
- {
- var cacheList = CacheFactory.Cache.GetCache<List<MenuAuthorizeEntity>>(CacheKey);
- if (cacheList == null)
- {
- var list = await _menuAuthorizeService.GetListPartial(null);
- CacheFactory.Cache.SetCache(CacheKey, list);
- return list;
- }
- else
- {
- return cacheList;
- }
- }
- public bool Remove()
- {
- return CacheFactory.Cache.RemoveCache(CacheKey);
- }
- }
- }
|