.NET Architecture & System Design Interview Question #172

What is tenant-aware caching?

Security Architecture, Multi-Tenancy & Disaster Recovery Senior Advanced

Quick Interview Answer

Tenant-aware caching ensures cached entries belonging to one tenant cannot be returned to another. Cache keys commonly include the tenant identifier along with the resource identifier.

Detailed Explanation

Tenant-aware caching ensures cached entries belonging to one tenant cannot be returned to another. Cache keys commonly include the tenant identifier along with the resource identifier.

Invalidation, background refresh, and distributed-cache operations must use the same tenancy rules. Shared cache infrastructure is acceptable only when logical isolation is implemented correctly.

Code Example

Bad:
product:100

Better:
tenant:42:product:100
tenant:77:product:100