Skip to content
Snippets Groups Projects
user avatar
Emerson Macedo authored
a90d2835
History

TeslaCache

Build Status Coverage Status codecov

TeslaCache is a Basic Cache Middleware for Tesla. It will cache only GET requests for X milliseconds.

Installation

If available in Hex, the package can be installed by adding tesla_cache to your list of dependencies in mix.exs:

def deps do
  [
    {:tesla_cache, "~> 1.1.0"}
  ]
end

Usage:

defmodule GoogleClient do
  use Tesla

  plug Tesla.Middleware.Cache, ttl: :timer.seconds(2)
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/tesla_cache.