README.markdown in resque-restriction-0.2.0 vs README.markdown in resque-restriction-0.2.1
- old
+ new
@@ -23,14 +23,31 @@
restrict :per_day => 1000, :per_hour => 100, :per_300 => 30
#rest of your class here
end
-That means the InvitationJob can not be executed more than 1000 times per day, 100 times per hour and 30 times per 300 seconds.
+That means the InvitationJob can not be executed more than 1000 times per day, 100 times per hour and 30 times per 300 seconds. All restrictions have to be met for the job to execute.
-The argument of restrict method is a hash, the key of the hash is a period time, including :per_minute, :per_hour, :per_day, :per_week, :per_month, :per_year, and you can also define any period like :per_300 means per 300 seconds. the value of the hash is the job execution limit number in a period.
+The argument of restrict method is a hash, the key of the hash is a period time, including :concurrent, :per_minute, :per_hour, :per_day, :per_week, :per_month, :per_year, and you can also define any period like :per_300 means per 300 seconds. The value of the hash is the job execution limit number in a period. The :concurrent option restricts the number of jobs that run simultaneously.
+Advance
+-------
+
+You can also add customized restriction as you like. For example, we have a job to restrict the facebook post numbers 40 times per user per day, we can define as:
+
+ class GenerateFacebookShares < Resque::Plugins::RestrictionJob
+ restrict :per_day => 40
+
+ def self.identifier(options)
+ [self.to_s, options["user_id"]].join(":")
+ end
+
+ #rest of your class here
+ end
+
+options["user_id"] returns the user's facebook uid, the key point is that the different identifiers can restrict different job execution numbers.
+
Contributing
------------
Once you've made your commits:
@@ -41,9 +58,13 @@
5. That's it!
Author
------
Richard Huang :: flyerhzm@gmail.com :: @flyerhzm
+
+Contributors
+------------
+Matt Conway :: matt@conwaysplace.com :: @mattconway
Copyright
---------
Copyright (c) 2010 Richard Huang. See LICENSE for details.