live-forum/server/webapi/LiveForum/LiveForum.Code/SystemCache/ISystemCacheService.cs
2026-03-24 11:27:37 +08:00

37 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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();
}
}