Sha256: 4bf5c147d54be4a544db55d16e88a7027b41b6a0e955453ede56daf272874404

Contents?: true

Size: 288 Bytes

Versions: 2

Compression:

Stored size: 288 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cache_keeper-0.4.1 app/models/cache_keeper/cached_method/refreshable.rb
cache_keeper-0.4.0 app/models/cache_keeper/cached_method/refreshable.rb