Skip to content

Commit 72c2afa

Browse files
committed
Merge pull request #97 from ruudk/feature-prefix-env
Added a PREFIX environment variable to set the Resque prefix
2 parents cd85e8b + 01c291f commit 72c2afa

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ the `COUNT` environment variable:
223223

224224
$ COUNT=5 bin/resque
225225

226+
### Custom prefix ###
227+
228+
When you have multiple apps using the same Redis database it is better to
229+
use a custom prefix to separate the Resque data:
230+
231+
$ PREFIX=my-app-name bin/resque
232+
226233
### Forking ###
227234

228235
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
371378
* Matt Heath
372379
* jjfrey
373380
* scragg0x
381+
* ruudk

bin/resque

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ if(!empty($COUNT) && $COUNT > 1) {
7171
$count = $COUNT;
7272
}
7373

74+
$PREFIX = getenv('PREFIX');
75+
if(!empty($PREFIX)) {
76+
fwrite(STDOUT, '*** Prefix set to '.$PREFIX."\n");
77+
Resque_Redis::prefix($PREFIX);
78+
}
79+
7480
if($count > 1) {
7581
for($i = 0; $i < $count; ++$i) {
7682
$pid = Resque::fork();

0 commit comments

Comments
 (0)