You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.6 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.RedisModule
{
public interface IRedisService
{
/// <summary>
/// 设置长时间存在的值
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
bool SetLongValue(string key, string value);
/// <summary>
/// 设置值,并设置清除时间
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="outSecond"></param>
/// <returns></returns>
bool SetValue(string key, string value, int outSecond);
/// <summary>
/// 设置值,存在则覆盖,并沿用之前的清除时间
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
bool SetValue(string key, string value);
/// <summary>
/// 是否存在key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
bool Exists(string key);
// <summary>
/// 更新Key把自动注销时间设置为原来的key的时间,不存在返回false
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
bool UpdateValue(string key, string value);
/// <summary>
/// 获取值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
string? GetValue(string key);
/// <summary>
/// 获得json序列化后的
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
T? GetValue<T>(string key);
/// <summary>
/// 获取值
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
T? GetEntity<T>(string key);
/// <summary>
/// 获取列表 模糊匹配
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
List<T>? GetLike<T>(string key);
/// <summary>
/// 删除
/// </summary>
/// <param name="key"></param>
void DeleteKey(string key);
/// <summary>
/// 模糊删除
/// </summary>
/// <param name="key"></param>
void DeleteLike(string key);
}
}