Sha256: ad10309148073f1aa83d48195617596a2581921bbdf27859d7704a50ecd13d74
Contents?: true
Size: 837 Bytes
Versions: 5
Compression:
Stored size: 837 Bytes
Contents
# frozen_string_literal: true require 'thermos/beverage' require 'thermos/beverage_storage' require 'thermos/dependency' require 'thermos/notifier' require 'thermos/refill_job' require 'thermos/rebuild_cache_job' module Thermos def self.keep_warm(key:, model:, id:, deps: [], lookup_key: nil, filter: nil, &block) fill(key: key, model: model, deps: deps, lookup_key: lookup_key, filter: filter, &block) drink(key: key, id: id) end def self.fill(key:, model:, deps: [], lookup_key: nil, filter: nil, &block) BeverageStorage.instance.add_beverage( Beverage.new(key: key, model: model, deps: deps, action: block, lookup_key: lookup_key, filter: filter) ) end def self.drink(key:, id:) Rails.cache.fetch([key, id]) do BeverageStorage.instance.get_beverage(key).action.call(id) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
thermos-0.5.2 | lib/thermos.rb |
thermos-0.5.1 | lib/thermos.rb |
thermos-0.5.0 | lib/thermos.rb |
thermos-0.4.1 | lib/thermos.rb |
thermos-0.4.0 | lib/thermos.rb |