How to use redis as mediawiki cache backends: Difference between revisions
Jump to navigation
Jump to search
Created page with "<syntaxhighlight lang="bash" line> # 如果已经使用过 apcu 作为缓存,要先去除 apcu 缓存 grep -r apc /etc/php/8.2/ sudo emacs /etc/php/8.2/mods-available/apcu.ini # 注释掉对 apcu 的调用 </syntaxhighlight> <syntaxhighlight lang="bash" line> # 安装并配置 redis 作缓存后端 sudo apt install redis-server php-redis # 编辑 LocalSettings.php ## Shared memory settings ## $wgMainCacheType = CACHE_ACCEL; ## $wgMemCachedServers = []; ## $wgMainCac..." |
No edit summary |
||
Line 10: | Line 10: | ||
# 编辑 LocalSettings.php | # 编辑 LocalSettings.php | ||
$wgObjectCaches['redis'] = [ | $wgObjectCaches['redis'] = [ | ||
'class' => 'RedisBagOStuff', | 'class' => 'RedisBagOStuff', |
Revision as of 17:17, 14 May 2025
# 如果已经使用过 apcu 作为缓存,要先去除 apcu 缓存
grep -r apc /etc/php/8.2/
sudo emacs /etc/php/8.2/mods-available/apcu.ini # 注释掉对 apcu 的调用
# 安装并配置 redis 作缓存后端
sudo apt install redis-server php-redis
# 编辑 LocalSettings.php
$wgObjectCaches['redis'] = [
'class' => 'RedisBagOStuff',
'servers' => [ '127.0.0.1:6379' ],
// 'connectTimeout' => 1,
// 'persistent' => false,
// 'password' => 'secret',
// 'automaticFailOver' => true,
];
$wgMainCacheType = 'redis';
$wgParserCacheType = 'redis'; // 可选
$wgMessageCacheType = 'redis'; // 可选
// 若使用新版 API,可直接写 'redis'
// $wgMainCacheType = 'redis';
## $smwgMainCacheType = CACHE_REDIS;
$wgJobTypeConf['default'] = [
'class' => 'JobQueueRedis',
'redisServer' => '127.0.0.1:6379',
'redisConfig' => [],
'daemonized' => true
];