Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikesmullin/cakephp-php-resque-plugin
CakePHP PHP-Resque Plugin
https://github.com/mikesmullin/cakephp-php-resque-plugin
Last synced: about 1 month ago
JSON representation
CakePHP PHP-Resque Plugin
- Host: GitHub
- URL: https://github.com/mikesmullin/cakephp-php-resque-plugin
- Owner: mikesmullin
- Created: 2011-05-28T02:41:32.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-08-28T22:45:40.000Z (over 13 years ago)
- Last Synced: 2024-04-14T14:50:55.007Z (9 months ago)
- Language: PHP
- Homepage:
- Size: 181 KB
- Stars: 7
- Watchers: 3
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CakePHP PHP-Resque Plugin by Mike Smullin
============** Lets you use Resque within the CakePHP environment, complete with cake shell. **
Installation & Usage
------------Place this directory in your plugins dir:
git submodule add git://github.com/mikesmullin/CakePHP-PHP-Resque-Plugin.git ./app/plugins/resque/
Download the latest version of Chris Boulton's php-resque into `./app/plugins/resque/vendors/php-resque/`, as well:
git submodule update --init --recursive
Edit the file `./app/plugins/resque/config/resque.php` and remember to
configure whatever Resque.Redis.host and port are appropriate for your environment:switch (Configure::read('YourApp.environment')) {
$config['Resque']['Redis'] = array(
'host' => 'localhost',
'port' => 6379
);Then launch a new php-resque-worker fork, which will begin polling the master
Resque server for new jobs to run locally:cake resque help # to see available options
cake resque startHow to Queue a Job
------------var $components = array('Resque.Resque');
function action() {
Resque::enqueue('default', 'YourJobClass1', array($any, $params)); // queue it up
}or you can use the CakePHP Shell:
cake resque jobs # to see a list of available jobs
cake resque enqueue YourJobClass1 any other paramsHow to Write a Job
------------in the above example it would be a file saved as:
./app/vendors/shells/jobs/your_job_class1.php
and the code would look like:
class YourJobClass1 extends ResqueShell {
function perform() {
# CakePHP environment is within scope via ResqueShell base class and App::import()
$this->loadModel('User');
$users = $this->User->find('all');
// ...
$this->out('Done');
}
}AND make sure to `cake resque restart` with each change to any of your job classes.
Credits
------------CakePHP-PHP-Resque is written by Mike Smullin and is released under the WTFPL.
PHP-Resque is written by Chris Boulton see https://github.com/chrisboulton/php-resque
Based on Resque by defunkt see https://github.com/defunkt/resque