Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/upstash_ratelimit/src/lua-scripts/reset.ts>resetScript

Rate limiting library for serverless runtimes
Latest
variable resetScript
import { resetScript } from "https://deno.land/x/upstash_ratelimit@v2.0.5-canary/src/lua-scripts/reset.ts";

type

` local pattern = KEYS[1] -- Initialize cursor to start from 0 local cursor = "0" repeat -- Scan for keys matching the pattern local scan_result = redis.call('SCAN', cursor, 'MATCH', pattern) -- Extract cursor for the next iteration cursor = scan_result[1] -- Extract keys from the scan result local keys = scan_result[2] for i=1, #keys do redis.call('DEL', keys[i]) end -- Continue scanning until cursor is 0 (end of keyspace) until cursor == "0" `