GamendWeb.RateLimit.Redis (gamend_web v1.0.1216)

Copy Markdown View Source

Redis-backed rate limiter backend powered by Hammer + Redix.

Counters live in Redis, so limits are enforced across all app instances sharing the same Redis — the right choice for multi-instance deployments.

Summary

Functions

child_spec(opts)

@spec child_spec(Keyword.t()) :: Supervisor.child_spec()

get(key, scale)

Callback implementation for Hammer.get/2.

hit(key, scale, limit, increment \\ 1)

Callback implementation for Hammer.hit/4.

inc(key, scale, increment \\ 1)

Callback implementation for Hammer.inc/3.

set(key, scale, count)

Callback implementation for Hammer.set/3.

start_link(opts)

@spec start_link(Hammer.Redis.redis_options()) ::
  {:ok, pid()} | :ignore | {:error, term()}