Small changes causing large refetches
Use case
I am building project management application with 2 types of tasks - 1) project tasks 2) workspace tasks (these are tasks that are not part of any project).
Currently I have tasks stored in the cache in the following ways -
1) Tasks for each stage in a project - ["tasks", "project", projectId]
2) All the tasks of a company (across projects and the workspace) - ["tasks", "all"]
When I click on any of these tasks, I fetch the whole task which opens in a panel
3) Specific task - [tasks, taskId]
When I make an update (eg -due date change) to a task that is part of a project, I invalidate (1, 2 & 3). Is it bad design to have the same task exist in 3 different caches and having to update all 3? If so, what would be the best way to optimize? one large fetch which pre-fills the cache?
2 Replies
exotic-emerald•3y ago
Is it bad design to have the same task exist in 3 different caches and having to update all 3?no that's fine, document caches work that way. Anything else you'd need a normalized cache, which RQ doesn't have out of the box. But invalidation will only refetch the currently active one, and it will then refetch the others when they are being used the next time, so this is fine.
ambitious-aquaOP•3y ago
Makes sense!