jdp (owner)

Revisions

gist: 225474 Download_button fork
public
Description:
Simple Resque client in PHP, with Redisent
Public Clone URL: git://gist.github.com/225474.git
Embed All Files: show embed
resque.php #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'redisent.php';
 
class Resque {
 
function __construct($server, $port) {
$this->redis = new Redisent($server, $port);
}
function push($queue, $object) {
$key = "resque:queue:{$queue}";
$this->redis->rpush($key, json_encode($object));
}
function pop($queue) {
$key = "resque:queue:{$queue}";
return json_decode($this->redis->lpop($key));
}
}
 
$queue = new Resque('localhost', 6379);
$queue->push('default', array('class'=>'ShellJob', 'args'=>array('which', 'cat')));