Smlr v0.1.0 Smlr.Plugs.Smlr View Source

Compresses the output of the plug with the correct compressor, if enabled cache the compressed output so that when requested again we can return it instantly rather than having to compress it again.

Add the plug at the bottom of one or more pipelines in router.ex:

pipeline "myapp" do
  # ...
  plug Smlr.Plugs.Smlr, [compressors: ["gzip", "deflate", "br"],
  cache: %{enabled: true, timeout: 3600, max_cache_responses: 10000, name: :smlr}]
end

Link to this section Summary

Functions

Call function. we check to see if the client has requested compression if it has, we register call back and compress before sending

Init function sets all default variables and .

Link to this section Functions

Call function. we check to see if the client has requested compression if it has, we register call back and compress before sending

Link to this function

compress_response(conn, opts)

View Source

Init function sets all default variables and .

Link to this function

parse_request_header(list, opts)

View Source
Link to this function

run_compress(body, binary)

View Source