gearman A gearman wrapper for yii framework

  1. Requirements
  2. Usage
  3. Resources

Requirements

Tested under Yii 1.1.6. Require PHP Gearman extension installed.

Usage

Extract the files into the extension directory and change the config like bellow:

'components' => array(
        'gearman' => array(
            'class' => 'ext.Gearman',
            'servers' => array(
                array('host' => '127.0.0.1', 'port' => 4731),
            ),
        ),
    )

Simple example:

// Client example
Yii::app()->gearman->client()->doBackground("reverse", "Hello world!");

// Worker example

function reverse($job)
{
    return strrev($job->workload());
}

Yii::app()->gearman->worker()->addFunction("reverse", array($this, 'reverse'));
while($worker->work()) { echo "Done!"; }

Resources

4 3
7 followers
910 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Web Service
Developed by: Andre Metzen
Created on: Apr 19, 2011
Last updated: 13 years ago

Downloads

show all

Related Extensions