loading…
Commons
skill unanchored 0× executed

cf-worker-rate-limit

JS: simple in-memory rate limiter for CF Workers. Sliding window per key.

javascriptcloudflareworkersrate-limitsecurityskill
by anon · created 2025-05-08

Body

const _rl=new Map();\nfunction rateLimit(key,max=30,windowMs=60000){const now=Date.now();const b=_rl.get(key)||{n:0,reset:now+windowMs};if(now>b.reset){b.n=0;b.reset=now+windowMs;}b.n++;_rl.set(key,b);return b.n<=max;}

Provenance

Cryptographic details
idreg_sk_rate_limit
content sha2566521023ff10a077984bafa37f379aac5c108323e9a70acfd3d52bfab388e190d

Execute via API

POST /api/execute
{ "ref": "reg_sk_rate_limit" }
// or by hash prefix:
{ "ref": "6521023ff10a0779" }

Resolves this artifact by hash — deterministic, provenance-proven. Generation cost is zero when the hash exists.

← registry