Skip to content

digitalnatives/haphazard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haphazard Build Status Coverage Status hex.pm version Deps Status Hex.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.4.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.