28 lines
911 B
C#
28 lines
911 B
C#
using System;
|
||
|
||
namespace FAuth.Extensions
|
||
{
|
||
/// <summary>
|
||
/// 数据缓冲提供器接口
|
||
/// </summary>
|
||
public interface ICacheProvider
|
||
{
|
||
/// <summary>
|
||
/// 设置缓存数据
|
||
/// </summary>
|
||
/// <typeparam name="T">数据类型</typeparam>
|
||
/// <param name="key">数据键</param>
|
||
/// <param name="obj">数据对象</param>
|
||
/// <param name="span">缓存时间或者从CacheTimeSpan选择值</param>
|
||
void SetCache<T>(string key,T obj,TimeSpan span) where T : class;
|
||
|
||
/// <summary>
|
||
/// 从缓存中获取数据,如果未缓存返回null
|
||
/// </summary>
|
||
/// <typeparam name="T">数据类型</typeparam>
|
||
/// <param name="key">缓存数据的键</param>
|
||
/// <returns>数据对象</returns>
|
||
T GetObj<T>(string key) where T : class, new();
|
||
}
|
||
}
|