Files
GX.O3.WMS/APP.O3/Shared/IRedisCacheClient.cs
T

43 lines
1.4 KiB
C#
Executable File

using System;
using System.Threading.Tasks;
namespace Opsoft.NetCore.O3App.Shared
{
/// <summary>
/// Redis缓存客户端接口
/// </summary>
public interface IRedisCacheClient
{
/// <summary>
/// 获取缓存
/// </summary>
T Get<T>(string key);
Task<T> GetAsync<T>(string key);
string Get(string key);
Task<string> GetAsync(string key);
object Get(string key, Type type);
Task<object> GetAsync(string key, Type type);
bool Set(string key, object model, long seconds);
Task<bool> SetAsync(string key, object model, long seconds);
/// <summary>
/// 设置缓存
/// </summary>
bool Set<T>(string key, long seconds, T model);
Task<bool> SetAsync<T>(string key, long seconds, T model);
/// <summary>
/// 删除缓存
/// </summary>
bool Delete(string key);
/// <summary>
/// 分布式锁的Redis实现
/// </summary>
bool Lock(string lockKey, int expireMsecs = 100000, int timeoutMsecs = 0);
bool Expire(string key, int seconds);
long Incr(string key);
long Incr(string key, int seconds);
Task<long> IncrAsync(string key, int seconds);
long Incr(string key, DateTime expireTime);
Task<long> IncrAsync(string key, DateTime expireTime);
}
}