class MarkpdfWeb::RateLimiter

Overview

Per-key fixed-window budget, used to keep auto-render-as-you-type from turning one visitor into a render farm. Keys that go quiet are pruned once the table grows past a few hundred entries.

Defined in:

web.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(max_per_window : Int32, window : Time::Span) #

[View source]

Instance Method Detail

def allow?(key : String) : Bool #

[View source]
def retry_after(key : String) : Int32 #

Seconds until the key's current window resets (0 when allowed).


[View source]