Sha256: 158cac4759436e78d396491e0066cd6e5ad641b2f6d7c409cceeae68aebbf087

Contents?: true

Size: 380 Bytes

Versions: 4

Compression:

Stored size: 380 Bytes

Contents

module CacheKeeper::CachedMethod::Refreshable
  def refresh(target)
    Rails.cache.fetch(cache_key(target), expires_in: expires_in) do
      target.send alias_for_original_method
    end
  end

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

  def autorefresh(target)
    return unless stale?(target)

    refresh_later target
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cache_keeper-0.6.1 app/models/cache_keeper/cached_method/refreshable.rb
cache_keeper-0.6.0 app/models/cache_keeper/cached_method/refreshable.rb
cache_keeper-0.5.1 app/models/cache_keeper/cached_method/refreshable.rb
cache_keeper-0.5.0 app/models/cache_keeper/cached_method/refreshable.rb