Browse files

Updated readme to include `Resque::Plugins::UniqueJob` instead of inh…

  • Loading branch information...
1 parent 3b68e59 commit f977f07e10b4d9deeeefe902687d630c6a5d7fe0 @jayniz jayniz committed Jul 15, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 README.markdown
@@ -1,4 +1,3 @@
@@ -38,12 +37,13 @@ Your queue is really full, so the job does not get executed right away. But the
At this point you will have two jobs in the queue, the second of which has no effect: You don't have to run it, once the cache has been updated for the first time. This is where resque-loner's UniqueJobs come in. If you define CacheSweeper like this:
- class CacheSweeper < Resque::Plugins::Loner::UniqueJob
- @queue = :cache_sweeps
+ class CacheSweeper
+ include Resque::Plugins::UniqueJob
+ @queue = :cache_sweeps
- def self.perform(article_id)
- # Cache Me If You Can...
- end
+ def self.perform(article_id)
+ # Cache Me If You Can...
+ end
Just like that you've assured that on the :cache_sweeps queue, there can only be one CacheSweeper job for each article. Let's see what happens when you try to enqueue a couple of these jobs now:

0 comments on commit f977f07

Please sign in to comment.