Book Image

CakePHP 2 Application Cookbook

Book Image

CakePHP 2 Application Cookbook

Overview of this book

Table of Contents (20 chapters)
CakePHP 2 Application Cookbook
Credits
Foreword
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Event stacking


Once we have the events in place, we could start thinking about dispatching events to an event queue to let another one process, possibly in a different server, pick up the payload, and process the task. This is a useful technique to move your background processing away from the runtime process, thus giving faster response times and allowing resource-intensive jobs to be queued and executed by an optimized server.

In this recipe, we're going to use the CakeResque plugin to create a job queue, using Redis and a worker to process your tasks.

Getting ready

First, make sure you have Redis 2.2 or later installed. Check the detailed setup instructions in the Redis documentation at http://redis.io/.

Then, download and install the CakeResque plugin. We'll do the setup using git and Composer, but if you're not using git, you can simply download the ZIP file, using the following command, and place the contents of the plugin in a folder named app/Plugin/CakeResque/:

$ git submodule add git...