Class Guard

java.lang.Object
dev.relism.flash.ext.limiter.Guard

public final class Guard extends Object
Manual rate-limit guard for lambda routes.

Available via FlashContext:


 Guard guard = ctx.require(Guard.class);
 

limit(java.lang.String, int, long, java.util.concurrent.TimeUnit) creates a Middleware that is composed once at route registration time — the resolver lambda is captured directly from the registry (no runtime map lookup):


 // 50 req/s per IP — fixed window (default)
 app.get("/api/search", handler, guard.limit("ip", 50, 1, TimeUnit.SECONDS));

 // 10 req/min per authenticated user — token bucket
 app.post("/api/export", handler, guard.limit("auth_user", 10, 1, TimeUnit.MINUTES, LimitStrategy.TOKEN_BUCKET));
 

The resolver name is looked up once here (at wiring time, not on each request). If the name is not registered, InitializationException is thrown immediately.