Class: Typhoeus::Cache::Rails
- Inherits:
-
Object
- Object
- Typhoeus::Cache::Rails
- Defined in:
- lib/typhoeus/cache/rails.rb
Overview
This module provides a simple way to cache HTTP responses in using the Rails cache.
Instance Method Summary collapse
- #get(request) ⇒ Object
-
#initialize(cache = ::Rails.cache, options = {}) ⇒ Rails
constructor
A new instance of Rails.
- #set(request, response) ⇒ Object
Constructor Details
Instance Method Details
#get(request) ⇒ Object
19 20 21 |
# File 'lib/typhoeus/cache/rails.rb', line 19 def get(request) @cache.read(request) end |
#set(request, response) ⇒ Object
23 24 25 |
# File 'lib/typhoeus/cache/rails.rb', line 23 def set(request, response) @cache.write(request.cache_key, response, :expires_in => request.cache_ttl || @default_ttl) end |