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.



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

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

Instance Method Details

#cached?(request) ⇒ Boolean

Returns:

  • (Boolean)


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

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

  exist?(file_path)
end

#clearObject



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

def clear
  # delete all files
end