Class: CMSScanner::Cache::Typhoeus

Inherits:
FileStore
  • Object
show all
Defined in:
lib/cms_scanner/cache/typhoeus.rb

Overview

Cache implementation for Typhoeus

Instance Attribute Summary

Attributes inherited from FileStore

#serializer, #storage_path

Instance Method Summary collapse

Methods inherited from FileStore

#clean, #entry_expiration_path, #entry_path, #initialize, #read_entry, #write_entry

Constructor Details

This class inherits a constructor from CMSScanner::Cache::FileStore

Instance Method Details

#get(request) ⇒ Typhoeus::Response

Parameters:

  • request (Typhoeus::Request)

Returns:



12
13
14
# File 'lib/cms_scanner/cache/typhoeus.rb', line 12

def get(request)
  read_entry(request.hash.to_s)
end

#set(request, response) ⇒ Object

Parameters:



18
19
20
21
22
# File 'lib/cms_scanner/cache/typhoeus.rb', line 18

def set(request, response)
  return if response.timed_out? || response.code&.zero?

  write_entry(request.hash.to_s, response, request.cache_ttl)
end