Skip to content

RESP3 is not supported, but latest StackExchange.Redis defaults to it when possible #404

@Mek7

Description

@Mek7

Describe the bug
CacheManager library does not handle RESP3 protocol properly. RESP3 is a new version of Redis protocol that is now supported by StackExchange.Redis and it is automagically preferred when, for example, connected to AMR (Azure Managed Redis).
When RESP3 is used, some operations may return different data types than before. CacheManager can't handle this change.
See: https://stackexchange.github.io/StackExchange.Redis/Resp3

To Reproduce
Steps to reproduce the behavior:

  1. Configure CacheManager to connect to AMR instance
  2. Call CacheManagerInstance.Get(key) where CacheManagerInstance is ICacheManager and key is a string
  3. Observe exception: System.InvalidCastException: Unable to cast object of type 'System.Byte[]' to type 'System.String'.
    at CacheManager.Core.Internal.BaseCache`1.GetCasted[TOut](Object value)...
  4. Expected behavior
    When CacheManager is connected to Azure Managed Redis, RESP3 should be used (as preferred by StackExchange.Redis) and there should be no exceptions from CacheManager.

    Additional context
    The workaround for now is to hardcode the protocol to RESP2 when configuring Redis protocol. See https://stackexchange.github.io/StackExchange.Redis/Resp3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions