Module: Prefetcher

Defined in:
lib/prefetcher.rb,
lib/prefetcher/version.rb,
lib/prefetcher/http_fetcher.rb,
lib/prefetcher/http_memoizer.rb

Defined Under Namespace

Classes: HttpFetcher, HttpMemoizer

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.redis_connectionObject



19
20
21
# File 'lib/prefetcher.rb', line 19

def self.redis_connection
  @redis_connection ||= Redis.new
end

.redis_connection=(conn) ⇒ Object



23
24
25
# File 'lib/prefetcher.rb', line 23

def self.redis_connection=(conn)
  @redis_connection = conn
end

.update_all(options = {}) ⇒ Object

Updates all memoized requests



13
14
15
16
17
# File 'lib/prefetcher.rb', line 13

def self.update_all(options = {})
  HttpMemoizer.new(options).get_list.each do |url|
    HttpFetcher.new(options.merge(url: url)).fetch
  end
end