Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Issue setting up Redis Static caching

Status Resolved
Add-on / Version Speedy 1.3.0
Severity
EE Version 6

Chad Nelson-Toohey

Dec 23, 2020

I went through and installed the speedy add on and configured Redis locally on the web server. I also made sure to enable the php-redis extension and added the following two lines to my config:

$config['speedy_driver'] = 'static';
$config['speedy_static_enabled'] = 'yes';

After doing all of the Redis driver shows as Available on the Speedy Control panel, but adding the local redis server and enabling Redis as Static in the settings results in Redis showing as ‘Unconfigured’ in the settings. Checking the warning it says the issue is, “Redis as Static is enabled, but no handler has been created.”.

One strange thing I noticed, is that setting $config[‘speedy_driver’] to ‘redis’ and disabling Redis as Static in the settings seems to start caching my static tags under redis (static pages tart loading extremely fast and redis reports items cached under the speedy settings)

 

#1

BoldMinded (Brian)

speedy_driver needs to be set to static, not redis. If you’re getting the error “Redis as Static is enabled, but no handler has been created.” it means that the utility files probably aren’t present. Searching the code for that error message reveals this:

if (isset($this->settings['static']) && $this->settings['static'] === 'y' && !file_exists($siteCachePath . '/configured.txt')) {

For example, this is my local environment’s config:

$config['speedy_enabled'] = 'no';
$config['speedy_static_enabled'] = 'yes';
$config['speedy_break_async'] = 'no';
$config['speedy_driver'] = 'static';
$config['speedy_static_settings'] = [
    'ignore_urls' => [
        ['url' => 'invalid/page'],
        ['url' => '^[a-z]{2}/products'],
        ['url' => '^products/.*'],
    ],
];
$config['speedy_redis_settings'] = [
    'static' => 'yes',
    'servers' => [
        [
            'host' => 'redis',
            'port' => '6379',
            'timeout' => '0',
            'password' => null,
        ]
    ],
    //'ignore_urls' => [
    //    ['url' => 'invalid/page'],
    //    ['url' => '^[a-z]{2}/products'],
    //    ['url' => '^products/.*'],
    //    ['url' => '^foo/.*'],
    //],
];

And I’m seeing this error message: https://www.dropbox.com/s/kir7f9o6jxulica/ticket-2219-speedy-home.png?dl=0

After I click the regenerate files, the error goes away, and I see the static folder at the root of my site: https://www.dropbox.com/s/5llriq80iwhtgfm/ticket-2219-static-folder.png?dl=0

What is in your /static folder?

#2

Chad Nelson-Toohey

So setting up my config file the same way that yours is configured (replacing ‘host’=>’redis’ with the actual server ip), and now static caching is working, but it it appears to be caching under the normal static option instead of redis, and the load speeds are about the same. When I had the speedy_driver config option set to redis and disabled Redis as Static in the settings, then all my {speedy:cache:static} tags started caching under redis and my load times significantly increased.

#3

Chad Nelson-Toohey

  • I meant the {exp:speedy:static} tag not {speedy:cache:static}
#4

BoldMinded (Brian)

Sorry, the config should be this:

$config['speedy_enabled'] = 'yes';
$config['speedy_static_enabled'] = 'yes';
$config['speedy_break_async'] = 'no';
$config['speedy_driver'] = 'redis';
$config['speedy_static_settings'] = [
    'ignore_urls' => [
        ['url' => 'invalid/page'],
        ['url' => '^[a-z]{2}/products'],
        ['url' => '^products/.*'],
    ],
];
$config['speedy_redis_settings'] = [
    'static' => 'yes',
    'servers' => [
        [
            'host' => 'redis',
            'port' => '6379',
            'timeout' => '0',
            'password' => null,
        ]
    ],
    //'ignore_urls' => [
    //    ['url' => 'invalid/page'],
    //    ['url' => '^[a-z]{2}/products'],
    //    ['url' => '^products/.*'],
    //    ['url' => '^foo/.*'],
    //],
];
#5

Chad Nelson-Toohey

Ok that makes more sense. Just to confirm as well ‘redis’ in the below section should be set to the ip for the redis server, correct?

'servers' => [
        [
            'host' => 'redis',
            'port' => '6379',
            'timeout' => '0',
            'password' => null,
        ]
    ],
#6

BoldMinded (Brian)

IP or the host name yeah. I’ll update the docs accordingly (for both issues)

#7

Chad Nelson-Toohey

Ok awesome, that seems to be working a lot faster now and is reporting the cached items under the ‘redis’ option in the admin panel. Thanks for all your help today!

Login to reply