diff options
author | David Yip <yipdw@member.fsf.org> | 2017-11-15 18:08:03 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-11-15 18:12:31 -0600 |
commit | 8fc54890e50de024683d9b763b8ed8f82d46433a (patch) | |
tree | 72063261b883fd1f7e4700ce6f824c3707a16a9b | |
parent | cb4ef24ac9d48e70648135f106fdc275dedf14fc (diff) |
Prefix cache keys with the matcher type. #208.
We already know about one regex limitation, which is that they cannot segment words in e.g. Japanese, Chinese, or Thai. It may also end up that regex matching is too slow compared to other methods. However, the regex is an implementation detail. We still want the ability to switch between "occurs anywhere" and "match whole word", and caching the matcher result is likely to still be important (since the matcher itself won't change nearly as often as status ingress rate). Therefore, we ought to be able to change the cache keys to reflect a change of data structure. (Old cache keys expire within minutes, so they shouldn't be too big of an issue. Old cache keys could also be explicitly removed by an instance administrator.)
-rw-r--r-- | app/models/glitch/keyword_mute.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/glitch/keyword_mute.rb b/app/models/glitch/keyword_mute.rb index 733dd0bc8..001be9201 100644 --- a/app/models/glitch/keyword_mute.rb +++ b/app/models/glitch/keyword_mute.rb @@ -59,7 +59,7 @@ class Glitch::KeywordMute < ApplicationRecord class TextMatcher < RegexpMatcher def self.cache_key(account_id) - format('keyword_mutes:regex:%s', account_id) + format('keyword_mutes:regex:text:%s', account_id) end def =~(str) @@ -79,7 +79,7 @@ class Glitch::KeywordMute < ApplicationRecord class TagMatcher < RegexpMatcher def self.cache_key(account_id) - format('keyword_mutes:tag:%s', account_id) + format('keyword_mutes:regex:tag:%s', account_id) end def =~(tags) |