Redis

Adds Redis cache and queue to Flarum

Incompatible with Flarum 0.1.0-beta.14

2,397 downloads

released on Nov 4, 2019

Tags

  • cache

  • bokt

  • redis

  • queue

0
0

Redis cache & queues

This extension allows using Redis as cache or for the queue. You can only enable the queue or cache by using a local extender (the extend.php in the root of your Flarum installation). See the configuring section below.

This is an advanced extension for webmasters able to configure redis and the queue workers.

Installation

Use Bazaar or install manually with composer:

composer require bokt/flarum-redis

Configuring cache

In your extend.php:


return [
    new Bokt\Redis\Extend\EnableRedisCache([
        'host' => '127.0.0.1',
        'password' => null,
        'port' => 6379,
        'database' => 1,
    ]),
];

This will immediately override the Flarum cache to use redis.

Configuring queue

In your extend.php:

return [
    new Bokt\Redis\Extend\EnableRedisQueue([
        'host' => '127.0.0.1',
        'password' => null,
        'port' => 6379,
        'database' => 1,
    ]),
];

Make sure to start your queue workers, see the laravel documentation for specifics. To test the worker can start use php flarum queue:work.

If you choose to enable the queue a load counter will show up on the admin dashboard for all queues used in your queue workers.

Updating

composer update bokt/flarum-redis

Links

Disclaimer

This extension is developed as an employee of @BartVB at Bokt. Bokt is the largest equine community in the Netherlands. We're currently moving a phpBB forum with over 100 million posts to Flarum. By keeping both in sync until we're more feature complete, we offer our users a slow transition to this fantastic new platform.

Simplify the extend

You can combine the configuration array if you use both cache and queue:

return [
    new Bokt\Redis\Extend\EnableRedisCache($config = [
        'host' => '127.0.0.1',
        'password' => null,
        'port' => 6379,
        'database' => 1,
    ]),
    new Bokt\Redis\Extend\EnableRedisQueue($config),
];

Complex configuration

The configuration used is identical to the one used in Laravel, check the Laravel redis configuration for more information if you need to do some finetuning.

© 2020 Hyn by DaniĆ«l "Luceos" Klabbers. All rights reserved. · Extensions and extension information is provided by the respective (copyright holding) authors. · Images on Extiverse pages are from Unsplash.