在Ubuntu/bionic上安装的Concrete5中使用Redis作为缓存服务器

安装Redis服务器和PHP扩展。

sudo apt install -y redis php-redis
sudo systemctl restart apache2

修改Concrete5的设置

<?php

$redisDriver = [
    'core_filesystem' => [
        'class' => \Concrete\Core\Cache\Driver\RedisStashDriver::class,
        'options' => [
            'servers' => [
                [
                    'server' => 'localhost',
                    'port' => 6379,
                    'ttl' => 30
                ],
            ],
            'prefix'=>'core',
            'database'=> 2
        ],
    ],
];

$cache = [];
$session = [];

$cache = [
    'page' => [
        'adapter' => 'redis',
        'redis' => [
            'servers' => [
                [
                    'server' => 'localhost',
                    'port' => 6379,
                    'ttl' => 30
                ],
            ],
            'prefix'=>'page',
            'database'=> 1
        ],
    ],
    'levels' => [
        'overrides' => [
            'drivers' => $redisDriver,
        ],
        'expensive' => [
            'drivers' => $redisDriver,
        ],
        'object' => [
            'drivers' => $redisDriver,
        ],
    ],
];

$session = [
    'name' => 'CONCRETE5',
    'handler' => 'redis',
    'redis' => [
        'database' => 0,

    ],
    'servers' => [
        [
            'server' => 'localhost',
            'port' => 6379,
            'ttl' => 10
        ],
    ],
];

return [
    'cache' => $cache,
    'session' => $session,
    'misc'              => [
        'app_version_display_in_header' => false,
    ],
    'updates' => [
        // Skip the automatic check of new concrete5 versions availability
        'skip_core' => true,
    ],
];

请参考

    concrete5 (8.5.0 以降) で Redis を使う方法
广告
将在 10 秒后关闭
bannerAds