class Rack::Idempotency::RequestStorage
Attributes
request[R]
store[R]
Public Class Methods
new(store, request)
click to toggle source
# File lib/rack/idempotency/request_storage.rb, line 4 def initialize(store, request) @store = store @request = request end
Public Instance Methods
read()
click to toggle source
# File lib/rack/idempotency/request_storage.rb, line 9 def read return unless request.idempotency_key stored = store.read(storage_key) JSON.parse(stored) if stored end
write(response)
click to toggle source
# File lib/rack/idempotency/request_storage.rb, line 16 def write(response) return unless request.idempotency_key store.write(storage_key, response.to_json) end
Private Instance Methods
storage_key()
click to toggle source
# File lib/rack/idempotency/request_storage.rb, line 27 def storage_key "rack:idempotency:" + request.idempotency_key end