Haphazard Build StatusCoverage Statushex.pm versionDeps StatusHex.pm

Haphazard is an ETS based plug for caching response body. Check the Online Documentation

Installation

Add haphazard to your list of dependencies in mix.exs:

def deps do
  [{:haphazard, "~> 0.3.0"}]
end

put it in applications

applications: [:logger, ..., :haphazard]

Usage

Setup in your plug router:

plug Haphazard.Plug

Additional configurations (optional):

plug Haphazard.Plug,
  methods: ~w(GET HEAD),
  path: ~r/\/myroute/,
  ttl: 60_000,
  enabled: true

The additional configurations reflect the default values.

License

Source code is released under MIT License. Check LICENSE for more information.