<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://qingliezhiquan.com/index.php?action=history&amp;feed=atom&amp;title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF</id>
	<title>怎样使用 redis 作为 MediaWiki 的缓存后端 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://qingliezhiquan.com/index.php?action=history&amp;feed=atom&amp;title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF"/>
	<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;action=history"/>
	<updated>2026-07-08T05:15:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=8667&amp;oldid=prev</id>
		<title>Mwroot at 01:27, 10 October 2025</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=8667&amp;oldid=prev"/>
		<updated>2025-10-10T01:27:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:27, 10 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{#seo:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{#seo:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|description=本文讲述在 mediawiki 中，用 redis 缓存，替换 apcu 缓存的方法。这样可以更方便地使用 Semantic MediaWiki 的缓存功能。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|description=本文讲述在 mediawiki 中，用 redis 缓存，替换 apcu 缓存的方法。这样可以更方便地使用 Semantic MediaWiki 的缓存功能。}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|keywords=redis, mediawiki, backends, 缓存&lt;/del&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 去除 apcu ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 去除 apcu ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key selfmoney_wiki:diff:1.41:old-8657:rev-8667:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
	<entry>
		<id>https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=8657&amp;oldid=prev</id>
		<title>Mwroot at 01:04, 10 October 2025</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=8657&amp;oldid=prev"/>
		<updated>2025-10-10T01:04:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:04, 10 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{#seo:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{#seo:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|title=怎样使用 redis 作为 MediaWiki 的缓存后端&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|description=本文讲述在 mediawiki 中，用 redis 缓存，替换 apcu 缓存的方法。这样可以更方便地使用 Semantic MediaWiki 的缓存功能。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|description=本文讲述在 mediawiki 中，用 redis 缓存，替换 apcu 缓存的方法。这样可以更方便地使用 Semantic MediaWiki 的缓存功能。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|keywords=redis, mediawiki, backends, 缓存}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|keywords=redis, mediawiki, backends, 缓存}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
	<entry>
		<id>https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=8634&amp;oldid=prev</id>
		<title>Mwroot at 06:42, 9 October 2025</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=8634&amp;oldid=prev"/>
		<updated>2025-10-09T06:42:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:42, 9 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{#seo:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|title=怎样使用 redis 作为 MediaWiki 的缓存后端&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|description=本文讲述在 mediawiki 中，用 redis 缓存，替换 apcu 缓存的方法。这样可以更方便地使用 Semantic MediaWiki 的缓存功能。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|keywords=redis, mediawiki, backends, 缓存}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 去除 apcu ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 去除 apcu ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key selfmoney_wiki:diff:1.41:old-7929:rev-8634:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
	<entry>
		<id>https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=7929&amp;oldid=prev</id>
		<title>Mwroot: Created page with &quot;== 去除 apcu == &lt;syntaxhighlight lang=&quot;bash&quot; line&gt; # 如果已经使用过 apcu 作为缓存，要先去除 apcu 缓存 grep -r apc /etc/php/8.2/ # 找到 apc 相关的配置行 sudo emacs /etc/php/8.2/mods-available/apcu.ini # 注释掉对 apcu 的调用  # 进 LocalSettings.php 取消对 CACHE_ACCEL 的调用 ## Shared memory settings ## $wgMainCacheType = CACHE_ACCEL; ## $wgMemCachedServers = []; &lt;/syntaxhighlight&gt;  == 使用 redis == &lt;syntaxhighlight lang=&quot;bash&quot; li...&quot;</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E6%A0%B7%E4%BD%BF%E7%94%A8_redis_%E4%BD%9C%E4%B8%BA_MediaWiki_%E7%9A%84%E7%BC%93%E5%AD%98%E5%90%8E%E7%AB%AF&amp;diff=7929&amp;oldid=prev"/>
		<updated>2025-09-29T02:15:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== 去除 apcu == &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt; # 如果已经使用过 apcu 作为缓存，要先去除 apcu 缓存 grep -r apc /etc/php/8.2/ # 找到 apc 相关的配置行 sudo emacs /etc/php/8.2/mods-available/apcu.ini # 注释掉对 apcu 的调用  # 进 LocalSettings.php 取消对 CACHE_ACCEL 的调用 ## Shared memory settings ## $wgMainCacheType = CACHE_ACCEL; ## $wgMemCachedServers = []; &amp;lt;/syntaxhighlight&amp;gt;  == 使用 redis == &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; li...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 去除 apcu ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
# 如果已经使用过 apcu 作为缓存，要先去除 apcu 缓存&lt;br /&gt;
grep -r apc /etc/php/8.2/ # 找到 apc 相关的配置行&lt;br /&gt;
sudo emacs /etc/php/8.2/mods-available/apcu.ini # 注释掉对 apcu 的调用&lt;br /&gt;
&lt;br /&gt;
# 进 LocalSettings.php 取消对 CACHE_ACCEL 的调用&lt;br /&gt;
## Shared memory settings&lt;br /&gt;
## $wgMainCacheType = CACHE_ACCEL;&lt;br /&gt;
## $wgMemCachedServers = [];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 使用 redis ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
# 安装并配置 redis 作缓存后端&lt;br /&gt;
sudo apt install redis-server php-redis&lt;br /&gt;
&lt;br /&gt;
# 编辑 LocalSettings.php&lt;br /&gt;
$wgObjectCaches[&amp;#039;redis&amp;#039;] = [&lt;br /&gt;
    &amp;#039;class&amp;#039;                =&amp;gt; &amp;#039;RedisBagOStuff&amp;#039;,&lt;br /&gt;
    &amp;#039;servers&amp;#039;              =&amp;gt; [ &amp;#039;127.0.0.1:6379&amp;#039; ],&lt;br /&gt;
    // &amp;#039;connectTimeout&amp;#039;    =&amp;gt; 1,&lt;br /&gt;
    // &amp;#039;persistent&amp;#039;        =&amp;gt; false,&lt;br /&gt;
    // &amp;#039;password&amp;#039;          =&amp;gt; &amp;#039;secret&amp;#039;,&lt;br /&gt;
    // &amp;#039;automaticFailOver&amp;#039; =&amp;gt; true,&lt;br /&gt;
];&lt;br /&gt;
&lt;br /&gt;
$wgMainCacheType    = &amp;#039;redis&amp;#039;;&lt;br /&gt;
$wgParserCacheType  = &amp;#039;redis&amp;#039;;        // 可选&lt;br /&gt;
$wgMessageCacheType = &amp;#039;redis&amp;#039;;        // 可选&lt;br /&gt;
// 若使用新版 API，可直接写 &amp;#039;redis&amp;#039;&lt;br /&gt;
// $wgMainCacheType = &amp;#039;redis&amp;#039;;&lt;br /&gt;
$smwgMainCacheType  = &amp;#039;redis&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
$wgJobTypeConf[&amp;#039;default&amp;#039;] = [&lt;br /&gt;
    &amp;#039;class&amp;#039;          =&amp;gt; &amp;#039;JobQueueRedis&amp;#039;,&lt;br /&gt;
    &amp;#039;redisServer&amp;#039;    =&amp;gt; &amp;#039;127.0.0.1:6379&amp;#039;,&lt;br /&gt;
    &amp;#039;redisConfig&amp;#039;    =&amp;gt; [],&lt;br /&gt;
    &amp;#039;daemonized&amp;#039;     =&amp;gt; true&lt;br /&gt;
 ];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 验证生效 ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
# 验证 redis 正常工作的方法三选一即可&lt;br /&gt;
&lt;br /&gt;
# 验证 redis 正常工作方法一&lt;br /&gt;
# 把以下写入 test.php 并打开，能看到 Hello, Redis! 返回&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$redis = new Redis();&lt;br /&gt;
$redis-&amp;gt;connect(&amp;#039;127.0.0.1&amp;#039;, 6379);&lt;br /&gt;
&lt;br /&gt;
// 设置一个键值对&lt;br /&gt;
$redis-&amp;gt;set(&amp;#039;test_key&amp;#039;, &amp;#039;Hello, Redis!&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
// 获取并输出该键的值&lt;br /&gt;
echo $redis-&amp;gt;get(&amp;#039;test_key&amp;#039;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# 验证 redis 正常工作方法二&lt;br /&gt;
# 在需要验证的页面用 ?action=purge 删掉缓存&lt;br /&gt;
# 用 &amp;lt;code&amp;gt;redis-cli&amp;lt;/code&amp;gt; 进入 redis 环境&lt;br /&gt;
KEYS * # 能看到一堆该 mediawiki 数据库相关的输出&lt;br /&gt;
&lt;br /&gt;
# 验证 redis 正常工作方法三&lt;br /&gt;
# 在 LocalSettings.php 中加入以下项查看日志&lt;br /&gt;
$wgDebugLogGroups[&amp;#039;redis&amp;#039;] = &amp;#039;/tmp/redis.log&amp;#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 微调配置 ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#################################&lt;br /&gt;
# 1. 基础持久化设置（AOF + RDB）&lt;br /&gt;
#################################&lt;br /&gt;
# 开启 AOF 持久化，每秒同步到磁盘&lt;br /&gt;
appendonly yes                               # :contentReference[oaicite:0]{index=0}&lt;br /&gt;
appendfilename &amp;quot;appendonly.aof&amp;quot;              # :contentReference[oaicite:1]{index=1}&lt;br /&gt;
appendfsync everysec                         # 推荐 everysec，在性能与安全间取平衡 :contentReference[oaicite:2]{index=2}&lt;br /&gt;
&lt;br /&gt;
# 保留默认 RDB 快照规则（作二级备份）&lt;br /&gt;
save 900 1          # 900 秒内有至少 1 次写操作时进行快照 :contentReference[oaicite:3]{index=3}&lt;br /&gt;
save 300 10         # 300 秒内有至少10 次写操作时进行快照 :contentReference[oaicite:4]{index=4}&lt;br /&gt;
save 60 10000       # 60 秒内有至少10000 次写操作时进行快照 :contentReference[oaicite:5]{index=5}&lt;br /&gt;
dir /var/lib/redis   # RDB/AOF 文件存放目录 :contentReference[oaicite:6]{index=6}&lt;br /&gt;
&lt;br /&gt;
################################################&lt;br /&gt;
# 2. 内存管理与淘汰策略（防止 OOM / 大对象泛滥）&lt;br /&gt;
################################################&lt;br /&gt;
# 设置 Redis 可用的最大内存，例如对小站点分配 256 MB&lt;br /&gt;
maxmemory 256mb                              # :contentReference[oaicite:7]{index=7}&lt;br /&gt;
# 当超过内存限制时，使用 LRU 淘汰所有键，保留常用热点&lt;br /&gt;
maxmemory-policy allkeys-lru                 # :contentReference[oaicite:8]{index=8}&lt;br /&gt;
&lt;br /&gt;
############################################&lt;br /&gt;
# 3. 网络、线程与安全（小型部署即可默认）&lt;br /&gt;
############################################&lt;br /&gt;
# 绑定本地接口，仅允许本地访问&lt;br /&gt;
bind 127.0.0.1                               # :contentReference[oaicite:9]{index=9}&lt;br /&gt;
protected-mode yes                           # 默认开启，防止未授权访问 :contentReference[oaicite:10]{index=10}&lt;br /&gt;
&lt;br /&gt;
# 可选：设置简单访问密码（生产环境推荐）&lt;br /&gt;
# requirepass your_redis_password&lt;br /&gt;
&lt;br /&gt;
##################################&lt;br /&gt;
# 4. 其他可选优化（根据需求启用）&lt;br /&gt;
##################################&lt;br /&gt;
# # 关闭 AOF 混合持久化前导快照（免得每次重写开销太大）&lt;br /&gt;
# aof-use-rdb-preamble no&lt;br /&gt;
&lt;br /&gt;
# # 开启主动碎片整理（Redis ≥4.0，当内存使用率过高时）&lt;br /&gt;
# activedefrag yes                             # :contentReference[oaicite:11]{index=11}&lt;br /&gt;
&lt;br /&gt;
# # 关闭无用模块以减少启动慢与内存开销&lt;br /&gt;
# # loadmodule /usr/lib/redis/redisearch.so&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
</feed>