# Hammer.Backend.Mnesia

An Mnesia backend for the [Hammer](

This package is under development and should not be used until an official
release is published.

## Todo

- [x] More options to create-table
- [x] Move the prune into a separate spin-off process
  - [ ] And make sure there's only one at a time?
- [ ] Documentation
  - [x] Module docs
  - [x] Generate docs
  - [ ] Getting-started guide
    - [ ] How to set up Mnesia
- [ ] Publish v0.5 (initial release)
- [ ] Test with load-test app

## Installation

is [available in Hex](, the package
can be installed by adding `hammer_backend_mnesia` to your list of dependencies in `mix.exs`:

def deps do
  [{:hammer_backend_mnesia, "~> 0.5"},
   {:hammer, "~> 6.0"}]

## Usage

First, set up an Mnesia schema, see this guide:

Then, create the Mnesia table for Hammer to use:


Configure the `:hammer` application to use the Mnesia backend:

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

And that's it, calls to `Hammer.check_rate/3` and so on will use Mnesia to store
the rate-limit counters.

See the [Hammer Tutorial]( for more.

## Documentation

On hexdocs:

## Getting Help

If you're having trouble, either open an issue on this repo, or reach out to the
maintainers ([@shanekilkelly]( on Twitter.