Files
OSS.Tools/Cache/OSS.Tools.Cache/IToolCache.cs
T
2023-05-23 10:47:19 +08:00

47 lines
1.4 KiB
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.
#region Copyright (C) 2016 Kevin (OSS开源系列) 公众号:OSSCore
/***************************************************************************
*   文件功能描述:全局插件 - 缓存插件接口
*
*   创建人: Kevin
* 创建人Email:1985088337@qq.com
*
*
*****************************************************************************/
#endregion
namespace OSS.Tools.Cache
{
/// <summary>
/// 缓存插件接口
/// </summary>
public interface IToolCache//: IMemoryCache
{
/// <summary>
/// 添加固定过期时间缓存,如果存在则更新
/// </summary>
/// <typeparam name="T">添加缓存对象类型</typeparam>
/// <param name="key">添加对象的key</param>
/// <param name="obj">值</param>
/// <param name="cacheOpt"></param>
/// <returns>是否添加成功</returns>
Task<bool> SetAsync<T>(string key, T obj, CacheTimeOptions cacheOpt);
/// <summary>
/// 获取缓存对象
/// </summary>
/// <typeparam name="T">获取缓存对象类型</typeparam>
/// <param name="key">key</param>
/// <returns>获取指定key对应的值 </returns>
Task<T?> GetAsync<T>(string key);
/// <summary>
/// 移除缓存对象
/// </summary>
/// <param name="key"></param>
/// <returns>是否成功</returns>
Task<bool> RemoveAsync(params string[] key);
}
}