Module: CacheKeeper::CachedMethod::Refreshable

Included in:
CacheKeeper::CachedMethod
Defined in:
app/models/cache_keeper/cached_method/refreshable.rb

Instance Method Summary collapse

Instance Method Details

#refresh(instance) ⇒ Object



2
3
4
5
6
# File 'app/models/cache_keeper/cached_method/refreshable.rb', line 2

def refresh(instance)
  Rails.cache.fetch(cache_key, expires_in: expires_in) do
    instance.send alias_for_original_method
  end
end

#refresh_later(instance) ⇒ Object



8
9
10
# File 'app/models/cache_keeper/cached_method/refreshable.rb', line 8

def refresh_later(instance)
  CacheKeeper::RefreshJob.perform_later self, instance
end