# # frozen_string_literal: true # require "mutex_m" # require "forwardable" # module HTTPX::Plugins # module ResponseCache # class FileStore < Store # def initialize(dir = Dir.tmpdir) # @dir = Pathname.new(dir) # @store = {} # @hash_store.extend(Mutex_m) # end # def clear # @store.synchronize { @store.clear } # end # def _get(request) # return unless File.exist?(@dir.join(request.response_cache_key)) # @store.synchronize { @store[key] } # end # def set(key) # @store.synchronize do # resps = (@store[key] ||= []) # yield resps # end # end # end # end # end