TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Better Rate Limiting with Redis Sorted Sets

7 点作者 StylifyYourBlog超过 10 年前

1 comment

heroic超过 10 年前
If say you wanted to perform an action 10 times a minute and also maintain a gap(in other words, time between action to be 6 seconds), could you simply not have done this:<p>1) Use SETNX, if you are able to do it, then set a TTL of 6 seconds on the key. Do these in a MULTI. 2) Perform action.<p>Now you have rate limiting as well as gap between actions. Also, no blocked actions, will affect anything. If I got something wrong from your post, do let me know.