diff --git a/README.md b/README.md index 8e11988..bfdc302 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,13 @@ the `COUNT` environment variable: $ COUNT=5 bin/resque +### Custom prefix ### + +When you have multiple apps using the same Redis database it is better to +use a custom prefix to separate the Resque data: + + $ PREFIX=my-app-name bin/resque + ### Forking ### Similarly to the Ruby versions, supported platforms will immediately @@ -371,3 +378,4 @@ Called after a job has been queued using the `Resque::enqueue` method. Arguments * Matt Heath * jjfrey * scragg0x +* ruudk diff --git a/bin/resque b/bin/resque index 78befad..2b605ce 100644 --- a/bin/resque +++ b/bin/resque @@ -71,6 +71,12 @@ if(!empty($COUNT) && $COUNT > 1) { $count = $COUNT; } +$PREFIX = getenv('PREFIX'); +if(!empty($PREFIX)) { + fwrite(STDOUT, '*** Prefix set to '.$PREFIX."\n"); + Resque_Redis::prefix($PREFIX); +} + if($count > 1) { for($i = 0; $i < $count; ++$i) { $pid = Resque::fork();