Class: HTTPX::Plugins::ResponseCache::FileStore

Inherits:
Store
  • Object
show all
Defined in:
lib/httpx/plugins/response_cache/file_store.rb

Instance Method Summary collapse

Methods inherited from Store

#cache, #lookup, #prepare

Constructor Details

#initialize(dir = Dir.tmpdir) ⇒ FileStore

Returns a new instance of FileStore.



8
9
10
# File 'lib/httpx/plugins/response_cache/file_store.rb', line 8

def initialize(dir = Dir.tmpdir)
  @dir = Pathname.new(dir)
end

Instance Method Details

#cached?(request) ⇒ Boolean

Returns:



16
17
18
19
20
# File 'lib/httpx/plugins/response_cache/file_store.rb', line 16

def cached?(request)
  file_path = @dir.join(request.response_cache_key)

  exist?(file_path)
end

#clearObject



12
13
14
# File 'lib/httpx/plugins/response_cache/file_store.rb', line 12

def clear
  # delete all files
end