Browse files

added readme

  • Loading branch information...
1 parent 261638a commit 16fe81a49aacb97c99b20a4faf9ba78942f5271c @tobi committed May 1, 2008
Showing with 18 additions and 0 deletions.
  1. +18 −0 README
View
18 README
@@ -0,0 +1,18 @@
+
+Throttle arbituary operation. Once limit is reached it will raise a Throttle::LimitExeeded exception.
+
+Example:
+
+ Throttle.for("feed:#{request.remote_ip}", :max => 20, :in => 10.minutes) do
+ render :xml => Articles.all
+ end
+
+ If you want to clear the timeout for the current block ( for example: fraud protection. Clear the throttle when
+ the submitted Credit Card was valid. ) your block can accept a yielded throttle object and call the clear method
+
+ Throttle.for("cc:#{request.remote_ip}", :max => 20, :in => 10.minutes) do |throttle|
+ if am.pay(@credit_card)
+ throttle.clear
+ redirect_to :action => 'done'
+ end
+ end

0 comments on commit 16fe81a

Please sign in to comment.