Sharing technology, ideas, insights!
Call: +91 710 466 0336         Email: hello@sanisoft.com

Blog

[CakePHP] Do !dlroW olleH using Gearman

There was recently a discussion on the CakePHP mailing list on how to get started using Gearman with CakePHP, instead of going back and forth over mails a blog post is more illustrative.

The following is the code for using Gearman in CakePHP, The core php example given at http://gearman.org/index.php?id=getting_started has been ported.

Gearman worker as a shell (app/Console/Command/TestWorkerShell.php)

Run it from command line and keep it running

Gearman client as a controller (app/Controller/WorkerTestsController.php)

Access the above controller through your browser and see the magic. Mostly instead of $client->do() you will be using $client->doBackground() to put the job in background. This of course will not output anything in your browser, but I am sure you will figure out what needs to be done 🙂

About the Author

Amit Badkas is Zend certified PHP5 and Zend Framework engineer, and has been working in SANIsoft for past 10 years, his present designation is 'Technical Manager'

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.