Preheat status cache
This commit is contained in:
parent
6fa4e01139
commit
19b9e1e2c3
4 changed files with 16 additions and 4 deletions
8
app/services/warm_cache_service.rb
Normal file
8
app/services/warm_cache_service.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class WarmCacheService < BaseService
|
||||
def call(cacheable)
|
||||
full_item = cacheable.class.where(id: cacheable.id).with_includes.first
|
||||
Rails.cache.write(cacheable.cache_key, full_item)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue