Skip to content

Error using Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache 6.0.0 #1917

@davitgr

Description

@davitgr

After upgrading from .NET 5 to .NET 6, we are unable to write to the Redis cache using IDistributedCache.SetAsync in our WebAoi project. It works in in .NET 5 but not .NET 6. Below is the error message and also the code (_cache is IDistributedCache). Please advise, as this is breaking our application currently.

private async Task CacheSet(string key, object value, TimeSpan? expiration = null)
{
    await _cache.SetAsync(key, value.ToByteArray(),
        new DistributedCacheEntryOptions
        {
            AbsoluteExpirationRelativeToNow = expiration ?? _cacheExpiration
        }).ConfigureAwait(false);
}

2021-11-23 15:20:32.7672||ERROR|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|An unhandled exception has occurred while executing the request. ERR Error running script (call to f_3915ee22fda531a1d5661f2523d0443fd35ff0a4): @user_script:2: @user_script: 2: Wrong number of args calling Redis command From Lua script
2021-11-23 15:20:32.7750||ERROR|LoggerService.LoggerManager|Something went wrong: at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.SetAsync(String key, Byte[] value, DistributedCacheEntryOptions options, CancellationToken token)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions