Base solution for your next web application
Open Closed

Best practice when using caching #2603


User avatar
0
omar created

I trying to find the best way to implement cache per tenancy. As of right now, I am generating a cache key with the tenant id as follow.

var cacheKeyName  = $"tenant-{tenantId}";
ICache tenantCache = _cacheManager.GetCache(cacheKeyName );

Inside tenantCache, I have all cached entities that only belong to that tenant. For example, the tenantCache has entities like Student, Class, Course, etc.

Is this a good approach to manage the cache for the application?

Thank You!


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I couldn't think a better way right now, your solution seems very good :).