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

30 lines
848 B
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.Threading.Tasks;
namespace LiveForum.Code.SystemCache
{
/// <summary>
/// 字段缓存服务接口(基于实例字段的缓存,同一请求内共享,不依赖 Redis
/// 适用于配置数据等需要单请求级别缓存的场景
/// </summary>
/// <typeparam name="TValue">缓存值类型</typeparam>
public interface IFieldCacheService<TValue>
{
/// <summary>
/// 获取缓存值(如果缓存不存在,会调用加载方法)
/// </summary>
/// <returns>缓存值</returns>
Task<TValue> GetAsync();
/// <summary>
/// 清除实例字段缓存
/// </summary>
void ClearCache();
/// <summary>
/// 刷新缓存(清除并重新加载)
/// </summary>
Task RefreshCacheAsync();
}
}