Skip to content

RedisCache - Add options with key prefix #41677

Closed
@fenzad

Description

@fenzad

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

In presence of a single instance of Redis, I may need to use a multi-tenant environment. Meaning multiple and different applications using the same Redis instance. In this context I might set all keys of each single application with a predetermined prefix.

Unfortunately, the actual extension "Microsoft.Extensions.Caching.StackExchangeRedis" not provide to set a prefix for the application.

Describe the solution you'd like

Add a option "KeyPrefix" in the class: https://github.com/dotnet/aspnetcore/blob/main/src/Caching/StackExchangeRedis/src/RedisCacheOptions.cs

Manage this option in the class:
https://github.com/dotnet/aspnetcore/blob/main/src/Caching/StackExchangeRedis/src/RedisCache.cs
using the extension WithKeyPrefix of IDatabase (https://github.com/StackExchange/StackExchange.Redis/blob/main/src/StackExchange.Redis/KeyspaceIsolation/DatabaseExtension.cs).

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-cachingIncludes: StackExchangeRedis and SqlServer distributed caches

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions