Class: FHTTPClient::Cache::Rails
- Inherits:
-
Object
- Object
- FHTTPClient::Cache::Rails
- Defined in:
- lib/f_http_client/cache/rails.rb
Class Method Summary collapse
Class Method Details
.fetch(name, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/f_http_client/cache/rails.rb', line 9 def fetch(name, = {}) raise RailsNotDefined unless defined?(::Rails) cache_entry = cache.read(name) return cache_entry if cache_entry.present? return unless block_given? result = yield cache.write(name, result, ) unless [:skip_if]&.(result) result end |