diff options
Diffstat (limited to 'app/models/concerns/redis_cacheable.rb')
-rw-r--r-- | app/models/concerns/redis_cacheable.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/concerns/redis_cacheable.rb b/app/models/concerns/redis_cacheable.rb index f1d29ad5a90..460cb529715 100644 --- a/app/models/concerns/redis_cacheable.rb +++ b/app/models/concerns/redis_cacheable.rb @@ -33,6 +33,14 @@ module RedisCacheable clear_memoization(:cached_attributes) end + def merge_cache_attributes(values) + existing_attributes = Hash(cached_attributes) + merged_attributes = existing_attributes.merge(values.symbolize_keys) + return if merged_attributes == existing_attributes + + cache_attributes(merged_attributes) + end + private def cache_attribute_key |