29 lines
715 B
C#
29 lines
715 B
C#
|
using Bunny.Common.Connect;
|
|||
|
using StackExchange.Redis;
|
|||
|
|
|||
|
namespace Bunny.Service.IService.Service;
|
|||
|
|
|||
|
public class RedisOptionService : IRedisOptionService
|
|||
|
{
|
|||
|
private readonly IDatabase _redisDatabase = RedisContext.RedisDatabase;
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 添加Redis中一个值
|
|||
|
/// </summary>
|
|||
|
/// <param name="key"></param>
|
|||
|
/// <param name="value"></param>
|
|||
|
public void AddStringValue(string key, string value)
|
|||
|
{
|
|||
|
_redisDatabase.StringSet(key, value);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 查询字符串Key
|
|||
|
/// </summary>
|
|||
|
/// <param name="key"></param>
|
|||
|
public string QueryStringKey(string key)
|
|||
|
{
|
|||
|
return _redisDatabase.StringGet(key).ToString();
|
|||
|
}
|
|||
|
}
|