Sha256: 2b3e52dd424ec61de1121b21da20d9e5779c72b94dd27de1fad9830f8345b35e
Contents?: true
Size: 830 Bytes
Versions: 53
Compression:
Stored size: 830 Bytes
Contents
module AppManager module Actions class ResponseCache def initialize(cache_path) @cache_path = cache_path @expires_in = AppManager.configuration.expires_in || 1.day end def present? cached_response.present? end def body cached_response['body'] end def status cached_response['status'] end def headers cached_response['headers'] end def cached_response @cached_response ||= Rails.cache.read(@cache_path) end def write_cache(response) cache_object = { body: response.body, status: response.status, headers: response.headers }.as_json Rails.cache.write(@cache_path, cache_object, expires_in: @expires_in) end end end end
Version data entries
53 entries across 53 versions & 1 rubygems