i have a user which can have a lot of saved searches and a lot of tasks. i'm caching them using the following
- cache user do
- user.tasks.each do |task|
- cache task do
# do something with task
- cache user do
- user.saved_searches.each do |search|
- cache search do
# do something with search
i've added the option to update the user, via touch
option, whenever any of these records are updated. the issue i want to clarify is this scenario:
i've updated a search which expires the cache for that search and in effect, the cache for user. since the cache for user has expired, user.tasks
will be executed.
is there a way to prevent this?
I'm thinking of adding a key to cache user
and manually expire the cache which I've been doing before I used the cache_digest
gem but I can't figure out how to do that.