From 2c32b36a57c7e00c34b06d3c223b291e06c651cc Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 18 Nov 2019 04:38:27 -0600 Subject: Remove filter caches. --- db/migrate/20191118102858_clear_filter_cache.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 db/migrate/20191118102858_clear_filter_cache.rb (limited to 'db/migrate') diff --git a/db/migrate/20191118102858_clear_filter_cache.rb b/db/migrate/20191118102858_clear_filter_cache.rb new file mode 100644 index 000000000..1c19f68d2 --- /dev/null +++ b/db/migrate/20191118102858_clear_filter_cache.rb @@ -0,0 +1,12 @@ +class ClearFilterCache < ActiveRecord::Migration[5.2] + include Redisable + + def change + ['custom_cw', 'filtered_threads', 'filtered_statuses'].each do |ns| + Rails.logger.info("Clearing keys matching '#{ns}:*' ...") + Rails.cache.delete_matched("#{ns}:*") + keys = redis.keys("#{ns}:*") + redis.del(*keys) unless keys.empty? + end + end +end -- cgit