1
0
Fork 0
mirror of https://github.com/edgurgel/httparrot synced 2025-04-06 00:32:34 -04:00
httparrot/lib/httparrot/request_store.ex
2016-10-08 20:18:49 +13:00

31 lines
595 B
Elixir

defmodule HTTParrot.RequestStore do
@moduledoc """
Used to store and retrived requests
"""
@doc """
Store the requests to the key
"""
def store(key, info) do
map = retrieve(key) ++ [info]
ConCache.put(:requests_registry, key, map)
end
@doc """
Get the saved request using the key
"""
def retrieve(key) do
entry = ConCache.get(:requests_registry, key)
case entry do
nil -> []
_ ->
entry
end
end
@doc """
Clear the saved data on the coresponding key
"""
def clear(key) do
ConCache.delete(:requests_registry, key)
end
end