Drupal 啟用 Redis 筆記

apt install redis-server

apt install php7.3-redis (選用自己安裝的版本)

接著是安裝drupal7的筆記

drush dl redis

drush en redis

vi vi sites/default/settings.php

$conf['redis_client_interface'] = 'PhpRedis'; // Can be "Predis".

$conf['redis_client_host']      = '127.0.0.1';  // Your Redis instance hostname.

$conf['lock_inc']               = 'sites/all/modules/redis/redis.lock.inc';

$conf['path_inc']               = 'sites/all/modules/redis/redis.path.inc';

$conf['cache_backends'][]       = 'sites/all/modules/redis/redis.autoload.inc';

$conf['cache_default_class']    = 'Redis_Cache';



錯誤訊息修正:

Deprecated function: Function Redis::delete() is deprecated in Redis_Lock_PhpRedis->lockRelease() (line 111 of /web/sites/all/modules/contrib/redis/lib/Redis/Lock/PhpRedis.php).



vi sites/all/modules/redis/lib/Redis/Lock/PhpRedis.php

111行修改內容

client->delete($key); => client->del($key);


如何測試? 把服務停掉網站掛掉...就代表有設定成功,測完別忘了start XD

/etc/init.d/redis-server stop


使用 https://pagespeed.web.dev/ 實測:

安裝前


安裝後

似乎有改善??

Drupal8的安裝筆記

composer require drupal/redis
drush en redis
web/sites/default/settings.php

$settings['redis.connection']['interface'] = 'PhpRedis'; // Can be "Predis".
$settings['redis.connection']['host']      = '127.0.0.1';  // Your Redis instance hostname.
$settings['cache']['default'] = 'cache.backend.redis';



WP也能使用
我有一個WP站,Plugin啟用後就有顯示成運作狀態






留言

熱門文章