Sha256: 057826a950b55fd08c0ef202058006d07e563ca04129db51b8871e19c883279d

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

# # 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
httpx-0.23.4 lib/httpx/plugins/response_cache/file_store.rb