37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace LiveForum.Code.SystemCache
|
||
{
|
||
/// <summary>
|
||
/// 系统缓存服务接口(用于底层支持需要的系统级缓存)
|
||
/// </summary>
|
||
/// <typeparam name="TValue">缓存值类型</typeparam>
|
||
public interface ISystemCacheService<TValue>
|
||
{
|
||
/// <summary>
|
||
/// 获取所有缓存数据(从缓存或数据库加载)
|
||
/// </summary>
|
||
/// <returns>缓存数据列表</returns>
|
||
Task<List<TValue>> GetAllAsync();
|
||
|
||
/// <summary>
|
||
/// 根据键获取缓存数据
|
||
/// </summary>
|
||
/// <param name="key">键</param>
|
||
/// <returns>缓存数据,如果不存在返回null</returns>
|
||
Task<TValue> GetByKeyAsync(object key);
|
||
|
||
/// <summary>
|
||
/// 清除缓存
|
||
/// </summary>
|
||
Task ClearCacheAsync();
|
||
|
||
/// <summary>
|
||
/// 刷新缓存(清除并重新加载)
|
||
/// </summary>
|
||
Task RefreshCacheAsync();
|
||
}
|
||
}
|
||
|