Closed jcorrea-origin closed 6 years ago
I'm not getting what the issue is you are having. You configured it to retry 100 times. Change it to 1 maybe? ;) Retry timeouts and redis connection timeout can all be configured, too
Thanks , i will try with that. And for some requets i will use Database.
I have a problem when i try to do GetOrAdd method. Some times redis does not response, so RetryHelper execute a retry many times. I need to go to the database to after the first retry. Limit the number of retires and the time of timeout too.
i am using this configuration
and this is my function
public T GetData(Func dataLoadFunc, string region, object locker = null)
{
try
{
//return _cache.GetOrAdd(_key, region, (k, r) => InvokeAndSet(dataLoadFunc, r, locker));
var item = _cache.GetOrAdd(_key, region, (k, r) => new CacheItem(k,r, dataLoadFunc(), ExpirationMode.Absolute, _expiration));
return item.Value;
}
catch(Exception e)
{
return InvokeAndSet(dataLoadFunc, region);
}