Haphazard is an ETS based plug for caching response body. Check the Online Documentation
Add haphazard to your list of dependencies in mix.exs:
def deps do
[{:haphazard, "~> 0.4.0"}]
endput it in applications
applications: [:logger, ..., :haphazard]Setup in your plug router:
plug Haphazard.PlugAdditional configurations (optional):
plug Haphazard.Plug,
methods: ~w(GET HEAD),
path: ~r/\/myroute/,
ttl: 60_000,
enabled: trueThe additional configurations reflect the default values.
Source code is released under MIT License. Check LICENSE for more information.