mhgbrown / cached_resource

Caching for ActiveResource
MIT License
80 stars 28 forks source link

clear_cache deletes everything #48

Closed jvnill closed 2 years ago

jvnill commented 2 years ago

We are using redis as our cache store. Using clear_cache deletes everything in redis, even sidekiq data.

mhgbrown commented 2 years ago

What happens when you call the underlying cache clear method? Does it take options (e.g. as described here) to preserve the sidekiq data?

jvnill commented 2 years ago

yeah but the clear_cache method offered by this gem does not accept any parameters. It should also be expected that when you do Thing.clear_cache, it would clear the cache for Thing only

mhgbrown commented 2 years ago

Ah I see, that makes total sense. I guess adding the options parameter is pretty trivial. As for deleting Thing only, it looks like https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-delete_matched would work. What do you think?

jvnill commented 2 years ago

yep I agree

mhgbrown commented 2 years ago

https://rubygems.org/gems/cached_resource/versions/5.2.0