README.md in improved-rack-throttle-0.7.1 vs README.md in improved-rack-throttle-0.8.0
- old
+ new
@@ -1,10 +1,11 @@
HTTP Request Rate Limiter for Rack Applications
===============================================
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/bensomers/improved-rack-throttle)
[![Dependency Status](https://gemnasium.com/bensomers/improved-rack-throttle.png)](https://gemnasium.com/bensomers/improved-rack-throttle)
+[![Build Status](https://travis-ci.org/bensomers/improved-rack-throttle.png?branch=master)](https://travis-ci.org/bensomers/improved-rack-throttle)
This is a [Rack][] middleware that provides logic for rate-limiting incoming
HTTP requests to Rack applications. You can use `Rack::Throttle` with any
Ruby web framework based on Rack, including with Ruby on Rails 3.0 and with
Sinatra.
@@ -35,32 +36,32 @@
### Adding throttling to a Rails 3.x application
# config/application.rb
require 'rack/throttle'
-
+
class Application < Rails::Application
config.middleware.use Rack::Throttle::Interval
end
### Adding throttling to a Sinatra application
#!/usr/bin/env ruby -rubygems
require 'sinatra'
require 'rack/throttle'
-
+
use Rack::Throttle::Interval
-
+
get('/hello') { "Hello, world!\n" }
### Adding throttling to a Rackup application
#!/usr/bin/env rackup
require 'rack/throttle'
-
+
use Rack::Throttle::Interval
-
+
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, world!\n"] }
### Enforcing a minimum 3-second interval between requests
use Rack::Throttle::Interval, :min => 3.0
@@ -84,23 +85,23 @@
use Rack::Throttle::Interval, :min => 3.0 # seconds
### Storing the rate-limiting counters in a GDBM database
require 'gdbm'
-
+
use Rack::Throttle::Interval, :cache => GDBM.new('tmp/throttle.db')
### Storing the rate-limiting counters on a Memcached server
require 'memcached'
-
+
use Rack::Throttle::Interval, :cache => Memcached.new, :key_prefix => :throttle
### Storing the rate-limiting counters on a Redis server
require 'redis'
-
+
use Rack::Throttle::Interval, :cache => Redis.new, :key_prefix => :throttle
### Scoping the rate-limit to a specific path and method
use Rack::Throttle::Interval, :rules => {:url => /api/, :method => :post}
@@ -186,12 +187,10 @@
status code by passing in a `:code => 503` option when constructing a
`Rack::Throttle::Limiter` instance.
Documentation
-------------
-UNDER DEVELOPMENT
-
<http://rubydoc.info/gems/improved-rack-throttle>
* {Rack::Throttle}
* {Rack::Throttle::Interval}
* {Rack::Throttle::Daily}
@@ -227,10 +226,10 @@
% wget http://github.com/bensomers/improved-rack-throttle/tarball/master
Authors
-------
-* [Ben Somers](mailto:somers.ben@gmail.com) - <http://www.somanyrobots.com>
+* [Ben Somers](mailto:somers.ben@gmail.com) - <http://www.github.com/bensomers>
* [Arto Bendiken](mailto:arto.bendiken@gmail.com) - <http://ar.to/>
* [Brendon Murphy](mailto:disposable.20.xternal@spamourmet.com>) - <http://www.techfreak.net/>
License
-------