The-Commit-Company / raven

Simple, open source team messaging platform
https://thecommit.company/products/raven
GNU Affero General Public License v3.0
295 stars 121 forks source link

Cache channel membership data #762

Open nikkothari22 opened 6 months ago

nikkothari22 commented 6 months ago

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:

  1. Cache the user's channel permission in Redis
  2. If a channel member is deleted/changed - clear the cache
  3. When checking permissions, read from cache, else fetch from DB and populate the cache (need a utility function for this)
linear[bot] commented 6 months ago

RAV-116 Cache channel membership data