Class: AppManager::Actions::ApiCacheHandler
- Inherits:
-
Object
- Object
- AppManager::Actions::ApiCacheHandler
- Defined in:
- lib/app_manager/api_cache_handler.rb
Instance Method Summary collapse
- #around(controller) ⇒ Object
-
#initialize(options) ⇒ ApiCacheHandler
constructor
A new instance of ApiCacheHandler.
Constructor Details
#initialize(options) ⇒ ApiCacheHandler
Returns a new instance of ApiCacheHandler.
4 5 6 7 |
# File 'lib/app_manager/api_cache_handler.rb', line 4 def initialize() @options = @expires_in = @options[:expires_in] end |
Instance Method Details
#around(controller) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/app_manager/api_cache_handler.rb', line 10 def around(controller) init(controller) if should_response_cache? log_info render_cached_response else yield @response_cache.write_cache(controller.response) if @request.get? end end |