Permalink
Browse files

Improved README.

  • Loading branch information...
1 parent 1c0be16 commit 655a3e4ad9541e14eaae7c3c897d5ad9e29c7bba @bendiken bendiken committed Mar 21, 2010
Showing with 12 additions and 8 deletions.
  1. +12 −8 README.md
View
@@ -1,27 +1,31 @@
HTTP Request Rate Limiter for Rack
==================================
-`Rack::Throttle` is [Rack][] middleware that provides support for
-rate-limiting incoming HTTP requests to your Rack application.
+This is [Rack][] middleware that provides logic for rate-limiting incoming
+HTTP requests to your Rack application. You can use `Rack::Throttle` with
+any Ruby web framework based on Rack, including with Ruby on Rails 3.0 and
+with Sinatra.
* <http://github.com/datagraph/rack-throttle>
Examples
--------
- require 'rack/throttle'
+### Adding throttling to a Rack application
-### Enforcing a 3-second delay between requests
+ require 'rack/throttle'
- use Rack::Throttle::Interval, :min => 3.0
+ use Rack::Throttle::Interval
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, world!\n"] }
-### Using a Memcached server to store rate-limiting counters
+### Enforcing a 3-second interval between requests
- use Rack::Throttle::Interval, :min => 3.0, :cache => Memcached.new
+ use Rack::Throttle::Interval, :min => 3.0
- run lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, world!\n"] }
+### Using a Memcached server to store rate-limiting counters
+
+ use Rack::Throttle::Interval, :cache => Memcached.new, :key_prefix => 'throttle'
Documentation
-------------

0 comments on commit 655a3e4

Please sign in to comment.