namespace langguanApi.Common.Redis
{
public class RedisOptions
{
public static readonly RedisOptions Default = new RedisOptions();
public RedisOptions()
{
this.Server = null;
this.Port = 6379;
this.Password = null;
this.Key = null;
this.Index = 0;
}
///
/// redis 服务地址
///
public string Server { get; set; }
///
/// redis 端口
///
public int Port { get; set; }
///
/// redis 连接密码
///
public string Password { get; set; }
///
/// 自定义Key
///
public string Key { get; set; }
///
/// 默认数据库索引
///
public int Index { get; set; }
public string Connection { get; set; }
///
/// 转换数据库连接字符串
///
///
///
public string GetConnect()
{
if (string.IsNullOrWhiteSpace(Password))
return $"{Server}";
else
return $"{Server},password={Password}";
}
}
}