Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

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

Rate limiting library for serverless runtimes
Go to Latest
variable resetScript
import { resetScript } from "https://deno.land/x/upstash_ratelimit@v1.1.0-canary-1/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" `