View Source A Mnesia backend for the Hammer rate-limiter

Hammer is a rate-limiter for the Elixir language. It's killer feature is a pluggable backend system, allowing you to use whichever storage suits your needs.

This package provides a Mnesia backend for Hammer, storing rate-limit counters in an Mnesia table.

To get started, read the Hammer Tutorial first, then add the hammer_backend_mnesia dependency:

    def deps do
      [{:hammer_backend_mnesia, "~> 0.6"},
      {:hammer, "~> 6.1"}]
    end

... then configure the :hammer application to use the Redis backend:

config :hammer,
  backend: {Hammer.Backend.Mnesia, [expiry_ms: 60_000 * 60 * 2,
                                    cleanup_interval_ms: 60_000 * 15]}

And create the Mnesia table for Hammer to use:

Hammer.Backend.Mnesia.create_mnesia_table()