Skip to content

Question: Does Spring Data Redis Support Runtime Multi-Tenancy for Redis Key Prefixing? #3130

@srosio

Description

@srosio

Hi Spring Data Redis Team,

I’m working on a multi-tenant application using Redis, and I need to ensure that Redis keys are prefixed with the tenant context (e.g., tenantA:User:123) to isolate data per tenant. However, I’ve been struggling with managing key prefixing through custom solutions, and it’s proving to be error-prone and difficult to maintain across various Redis operations.

My Question:

  • Does Spring Data Redis have built-in support for runtime multi-tenancy or a way to automatically apply tenant-aware key prefixing across all Redis operations (e.g., SADD, SMEMBERS, HSET, etc.) based on the current tenant context?
  • If not, is there an existing recommended approach to achieve this that doesn’t require extensive manual configuration or custom serializers?

I believe this functionality would be very beneficial for multi-tenant applications, and I would appreciate any advice or resources on how to implement this more effectively.

Thank you for your time and assistance!

Metadata

Metadata

Labels

for: stackoverflowA question that's better suited to stackoverflow.comstatus: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions