PHPackages                             stojg/silverstripe-resque - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. stojg/silverstripe-resque

ActiveSilverstripe-module[Caching](/categories/caching)

stojg/silverstripe-resque
=========================

Wraps around the resque code for background jobs

1.3.0(7y ago)623.5k21BSDPHP

Since Mar 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/stojg/silverstripe-resque)[ Packagist](https://packagist.org/packages/stojg/silverstripe-resque)[ Docs](http://github.com/stojg/silverstripe-resque)[ RSS](/packages/stojg-silverstripe-resque/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (1)Versions (12)Used By (1)

SilverStripe Resque
===================

[](#silverstripe-resque)

This modules wraps php-resque to be able to make scheduled background jobs in sweet harmony with redis.

Requirements
============

[](#requirements)

- SilverStripe with requirements
- Redis server
- (optional) a worker monitor, eg god or monit, to start and monitor the worker(s).
- This module requires that the PHP pcntl module is installed

*Still in development*

The principle is that a 'front-end' adds a job via Resque class, this is a very fast operation.

```
$args = array(
	'message' => 'from '.$_SERVER['HTTP_HOST'],
	'time' => date('Y-m-d H:i:s')
);
$token = Resque::enqueue("dev:ping", "SSResquePingJob", $args);

```

This will be sent over tcp to a redis server that will hold this information until a worker fetches it.

By starting one or many worker via the cli, they will pull jobs from a 'queue' on redis, ie: `dev:ping`. Then it will find a PHP class to run the job, `SSResquePingJob` populate it with the `$args` and then run `SSResquePingJob->perform()`.

```
public function perform() {
	echo 'Ping: '.$this->args['time'].' '.$this->args['message'].PHP_EOL;
}

```

Any exception or errors will mark the job as failed, and it's possible to requeue it.

Installation
============

[](#installation)

Install redis
-------------

[](#install-redis)

Via homebrew:

```
$ brew install redis

```

Or by compiling it, see [Redis Quick Start](http://redis.io/topics/quickstart) for more information.

```
$ sudo mkdir -p /usr/local/src
$ cd /usr/local/src
$ sudo wget http://download.redis.io/redis-stable.tar.gz
$ sudo tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ sudo make
$ sudo make install

```

There are most likely a suitable packages in your prefered linux distribution (untested).

[Search google](https://www.google.co.nz/search?q=install+redis+apt+yum)

Silverstripe Resque
-------------------

[](#silverstripe-resque-1)

```
$ git clone git@github.com:stojg/silverstripe-resque.git resque
$ cd resque
$ composer update

```

Usage
=====

[](#usage)

Start the redis server:

```
$ redis-server

```

Start the one worker for all queues in another terminal window

```
$ ./framework/sake dev/resque/run queue=*

```

In another terminal window, try creating a ping job

```
$ ./framework/sake dev/resque/ping

```

In the worker terminal you should now see something similar to

```
Ping: 2012-11-15 10:51:29 from hostname

```

Web interface
=============

[](#web-interface)

```
sudo gem install resque --no-ri -no-rdoc

```

Process monitor
===============

[](#process-monitor)

How to install god on ubuntu / debian: [How to monitor Resque with God and do it all with Capistrano on Ubuntu](https://gist.github.com/1275333)

Example configuration:

num\_workers = 2

num\_workers.times do |num| God.watch do |w| w.dir = "/var/www/site" w.name = "site-worker-#{num}" w.group = 'site-worker' w.interval = 30.seconds w.uid = 'www-data' w.gid = 'www-data' w.start = "/usr/bin/php ./framework/cli-script.php dev/resque/run queue=ping"

```
  # restart if memory gets too high
  w.transition(:up, :restart) do |on|
    on.condition(:memory_usage) do |c|
      c.above = 64.megabytes
      c.times = 2
    end
  end

  # determine the state on startup
  w.transition(:init, { true => :up, false => :start }) do |on|
    on.condition(:process_running) do |c|
      c.running = true
    end
  end

  # determine when process has finished starting
  w.transition([:start, :restart], :up) do |on|
    on.condition(:process_running) do |c|
      c.running = true
      c.interval = 5.seconds
    end

    # failsafe
    on.condition(:tries) do |c|
      c.times = 5
      c.transition = :start
      c.interval = 5.seconds
    end
  end

  # start if process is not running
  w.transition(:up, :start) do |on|
    on.condition(:process_running) do |c|
      c.running = false
    end
  end
end

```

end

Credits
=======

[](#credits)

Here are the giants which shoulders I'm standing standing on:

- [Chris Boulton](https://github.com/chrisboulton/php-resque) for PHP resque
- [defunkt](https://github.com/defunkt/resque/) the original resque for ruby
- [redis](http://redis.io/) for providing an awesome, stable and fast key value store
- [SilverStripe](http://www.silverstripe.org/) The place where I get paid to do stuff like this.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~254 days

Recently: every ~515 days

Total

10

Last Release

2557d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ffa59057c23c330890610ea045f407f8cdbc0fa36bde26d5a7a9aa18d5fd5197?d=identicon)[stojg](/maintainers/stojg)

---

Top Contributors

[![stojg](https://avatars.githubusercontent.com/u/485130?v=4)](https://github.com/stojg "stojg (2 commits)")[![mateusz](https://avatars.githubusercontent.com/u/118653?v=4)](https://github.com/mateusz "mateusz (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")

---

Tags

silverstriperedis

### Embed Badge

![Health badge](/badges/stojg-silverstripe-resque/health.svg)

```
[![Health](https://phpackages.com/badges/stojg-silverstripe-resque/health.svg)](https://phpackages.com/packages/stojg-silverstripe-resque)
```

###  Alternatives

[cache/redis-adapter

A PSR-6 cache implementation using Redis (PhpRedis). This implementation supports tags

534.0M27](/packages/cache-redis-adapter)[resquebundle/resque

A Symfony 4 bundle to manage Resque job queues

51138.3k1](/packages/resquebundle-resque)[matomo/cache

PHP caching library based on Doctrine cache

381.1M18](/packages/matomo-cache)[pstaender/silverstripe-redis-cache

Enables Redis cache for SilverStripe

11102.0k](/packages/pstaender-silverstripe-redis-cache)[ihor/cachalot

Cache a lot in a proper way (APC, XCache, Memcached, Redis, Couchbase)

2528.3k](/packages/ihor-cachalot)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
