<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Redis_cache_store</id>
	<title>Redis cache store - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Redis_cache_store"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Redis_cache_store&amp;action=history"/>
	<updated>2026-05-06T13:32:46Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Redis_cache_store&amp;diff=5111&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Redis_cache_store&amp;diff=5111&amp;oldid=prev"/>
		<updated>2024-10-18T06:44:45Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 06:44, 18 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Redis_cache_store&amp;diff=5110&amp;oldid=prev</id>
		<title>1&gt;Aviation hacker: Quick mention of the Request cache up top as well.</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Redis_cache_store&amp;diff=5110&amp;oldid=prev"/>
		<updated>2023-09-01T05:16:01Z</updated>

		<summary type="html">&lt;p&gt;Quick mention of the Request cache up top as well.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Performance}}&lt;br /&gt;
The Redis cache store is one of the best options to handle session and application cache as it supports: data guarantee, locking, key awareness. (and also can be used for [[Session_handling#Redis_session_driver|user&amp;#039;s sessions caching]] in the config.php file). Unfortunately due to the data types it supports and the data involved, it isn&amp;#039;t fully compatible with the request cache, and so we&amp;#039;ll only be configuring it for the Application and Session caches in this document. That isn&amp;#039;t to say you couldn&amp;#039;t have parts of the request cache using Redis, you would just need to manually set those cached objects to use Redis instead (and there are quite a few of them!).&lt;br /&gt;
&lt;br /&gt;
Before Redis is available as a cache store, you will need to install Redis service (daemon) on your Moodle server, locally in case of a single Moodle app node architecture or externally if you are using a cluster of Moodle nodes. only then, you can configure Redis as an application or session level cache store.&lt;br /&gt;
&lt;br /&gt;
If you are configuring a cluster of Moodle servers/nodes, the Redis service (daemon) should be installed on an external server and all Moodle nodes (servers/instances) should point to that external Redis, so that all the user&amp;#039;s cached data (namely Session) is available when the user is using/connected to any of the Moodle nodes. An external Redis (NoSQL) service can be installed on the main SQL server alongside the MySQL/MariaDB service, just make sure you have enough memory allocated on that server for both services. &lt;br /&gt;
&lt;br /&gt;
A good practice is to give the Redis cache store prefix a proper short name and not leave it empty, as later on, it might conflict with user&amp;#039;s session Redis cache you might choose to use, or other Moodle instances that will be installed on the same server. for example &amp;quot;my-school-name_cs_&amp;quot;, where you replace &amp;quot;my-school-name&amp;quot; with your short school name. (and if you are also using a user&amp;#039;s session store on the config.php file, you might like to prefix it with &amp;quot;my-school-name_us_&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
When using a cluster setup with several Moodle instances on each node that belong to different Schools/Institutes/clients, make sure that you use the same Prefix for all Moodle instances that are on different nodes and are of the same School/Institute/Client.&lt;br /&gt;
==Installing Redis server==&lt;br /&gt;
There are plenty of guides on the internet on how to install Redis, so we won&amp;#039;t repeat them here. Since Redis is a listening service, once it&amp;#039;s installed it&amp;#039;ll be ready to use (and should already be running) and ready to receive requests from Moodle, with no further configuration needed. With that said however, it&amp;#039;s still wise to have a look through the configuration options and decide what is best for you and your setup - the DigitalOcean guide is a good place to start for adjusting these settings, as they&amp;#039;re basically all in the redis.conf file.&lt;br /&gt;
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-22-04 DigitalOcean&amp;#039;s How To Install and Secure Redis on Ubuntu 22.04]&lt;br /&gt;
*[[Session_handling#Redis_session_driver]] and [https://www.digitalocean.com/community/tutorials/how-to-set-up-a-redis-server-as-a-session-handler-for-php-on-ubuntu-14-04 How to Set Up a Redis Server as a Session Handler for PHP]&lt;br /&gt;
* Install [https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/repoview/redis5.html Redis 5] via IUS CentOS 7 repository.&lt;br /&gt;
*[https://github.com/zkteco-home/redis-windows Redis Windows Port - zkteco-home/redis-windows on GitHub]&lt;br /&gt;
==Installing Redis php driver==&lt;br /&gt;
* For CentOS, you can use either [https://rpms.remirepo.net/ Remi] or [https://ius.io/ IUS] repositories, and install the [https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/repoview/php71u-pecl-redis.html php71u-pecl-redis] driver.&lt;br /&gt;
* [https://gist.github.com/hollodotme/418e9b7c6ebc358e7fda Redis php-fpm 7 driver on Ubuntu 14.04]&lt;br /&gt;
* [https://pecl.php.net/package/redis Windows PHP extensions] including DLLs for Windows. Check your PHP version, CPU (64bit or x86) and thread-safe value (see Site Admin &amp;gt; Server &amp;gt; PHP Info) to get the right version; add DLL file to ext directory, add &amp;#039;extension=php_redis.dll&amp;#039; entry to php.ini and restart your web server.&lt;br /&gt;
==Configuring Redis in Moodle==&lt;br /&gt;
* Navigate to Site admin &amp;gt; Plugins &amp;gt; Caching &amp;gt; Configuration.&lt;br /&gt;
* When installed, you should see a green tick next to &amp;quot;Redis&amp;quot; under &amp;quot;Installed cache stores&amp;quot; and a link to add an instance.&lt;br /&gt;
[[File:Redis_cache_ready.png]]&lt;br /&gt;
* Click &amp;quot;Add instance&amp;quot;.&lt;br /&gt;
** Give your Redis instance a name, like &amp;quot;Redis1&amp;quot; and set the IP:port for the Redis server. If it is on the same machine, the default would be 127.0.0.1:6379. &lt;br /&gt;
** The new instance should appear under &amp;quot;Configured store instances&amp;quot; with a &amp;quot;Ready&amp;quot; tick.&lt;br /&gt;
* Under &amp;quot;Stores used when no mapping is present&amp;quot; click &amp;#039;&amp;#039;&amp;#039;Edit mappings&amp;quot;. Set &amp;quot;Redis1&amp;quot; (or the name used earlier) for the &amp;quot;Application&amp;quot; and &amp;quot;Session&amp;quot; caches.&amp;#039;&amp;#039;&amp;#039; Note that Redis won&amp;#039;t appear under the &amp;quot;Request&amp;quot; Cache section, since it isn&amp;#039;t fully compatible with all of the different parts of the request cache. (Refer to the [[Caching]] page to better understand how the Moodle Universal Cache works).&lt;br /&gt;
[[File:Set_Redis_as_default_Application_and_Session_cache.png]]&lt;br /&gt;
* After saving this, you should see Redis as the cache for most cache stores, and should hopefully see a performance boost almost immediately.&lt;br /&gt;
* Next Step: Celebrate!&lt;br /&gt;
==See also==&lt;br /&gt;
* [https://gist.github.com/kabel/10023961 Monitor Redis stats (a php one page app)]&lt;br /&gt;
* MDL-48468 : Add a Redis cache store to Moodle core&lt;br /&gt;
* Redis lock : https://github.com/open-lms-open-source/moodle-local_redislock (get it into core: https://tracker.moodle.org/browse/MDL-67022)&lt;br /&gt;
* [https://redis.io/ Redis.io]&lt;br /&gt;
[[de:Redis Cache]]&lt;/div&gt;</summary>
		<author><name>1&gt;Aviation hacker</name></author>
	</entry>
</feed>