限制对 Ruby on Rails API 的请求 [英] Throttling requests to a Ruby on Rails API

查看:48
本文介绍了限制对 Ruby on Rails API 的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试向 Google 寻找一个 Rails 插件,该插件将允许限制特定资源消耗的请求量.Django 的 Piston 有一些开源代码.是否有现成的 Rails 可用的东西,或者可以安全地假设查看 Piston 是如何做到的并将其作为 Rails 插件移植是可以工作的吗?

Trying to Google around for an a Rails plugin that will allow for throttling the amount of requests a particular resource gets consumed. Django's Piston has some open source code for this. Is there something available out of the box for Rails or is it safe to assume that looking at how Piston does it and porting it as a Rails plugin is something that can be worked on?

推荐答案

这里有一些机架中间件可以完成您所追求的任务:http://github.com/dambalah/api-throttling

Here's some rack middleware that accomplishes what you're after: http://github.com/dambalah/api-throttling

这里有一篇关于中间件开发的博客文章:http://blog.messagepub.com/2009/05/05/how-to-rack-middleware-for-api-throttling/

and here's a blog post about the development of that middleware: http://blog.messagepub.com/2009/05/05/how-to-rack-middleware-for-api-throttling/

这篇关于限制对 Ruby on Rails API 的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆