While channel type is cached and helps improve perf for Open and public channels, for private channels we still have to check if the user is a member of the channel or not - this occurs in a db.exists query. The problem will compound when we add organisations (#679) and have to check permissions for users.
Solution:
Cache the user's channel permission in Redis
If a channel member is deleted/changed - clear the cache
When checking permissions, read from cache, else fetch from DB and populate the cache (need a utility function for this)
While channel type is cached and helps improve perf for Open and public channels, for private channels we still have to check if the user is a member of the channel or not - this occurs in a
db.exists
query. The problem will compound when we add organisations (#679) and have to check permissions for users.Solution: