Member 'EndPoints' cannot be initialized. It is not a field or property.
Hi
Server - AWS Elastic Cache Cluster mode with 2 nodes
Engine - 6.2.5
Client - StackExchange.Redis 2.1.58
This is our code which had been working until recently.
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace RedisHelper.Client
{
public class RedisHelperClient
{
// private static readonly Lazy<ConnectionMultiplexer> LazyConnection;
private static ConfigurationOptions _configurationOptions;
public RedisHelperClient(string argStrEndPoints, string argStrPassword, bool argSsl = false)
{
_configurationOptions = new ConfigurationOptions
{
EndPoints = { argStrEndPoints },
Password = argStrPassword,
AbortOnConnectFail = false,
KeepAlive = 30,
ConnectTimeout = 2 * 60 * 1000, // in millisond defulat 5 sec , currently changed to 2 minute
SyncTimeout = 2 * 60 * 1000, // in millisond defulat 5 sec , currently changed to 2 minute
Ssl = argSsl
};
_configurationOptions.CertificateValidation += (sender, cert, chain, errors) =>
{
//Console.WriteLine("errors: " + errors);
return true;
};
}
private static IDatabase RedisCache
{
get
{
return Connection.GetDatabase();
}
}
private static readonly Lazy<ConnectionMultiplexer> LazyConnection
= new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect(_configurationOptions));
public static ConnectionMultiplexer Connection
{
get
{
return LazyConnection.Value;
}
}
#region Check Keys
public async Task<bool> IsRedisKeyExistAsync(string argKeyName)
{
bool result = false;
try
{
result = await RedisCache.KeyExistsAsync(argKeyName);
}
catch (Exception ex)
{
throw ex;
}
return result;
}
}
}
But since we updated our StackExchange.Redis package to version 2.6.48, we are getting this error message :Member 'EndPoints' cannot be initialized. It is not a field or property.
Is there any logic change to the way we connect to redis, or is there is any alternative to this?