2.13.10.1.2. Setting up Memcache (d) in DLE
Setting method Memcache(d) differs in different DLE versions.
- Open the site admin panel.
- Go to section "Script settings → System Setup".
- Switch to tab "Optimization".
- Configure the following settings and save your changes:
- "Enable caching on the site" — enable the option.
- "Type of caching on the site" — select "Memcache".
- "Data for connecting to Memcache or Redis server" — paste the path to the Memcache socketdcopied from second the lines of the page with Memcache settings (d) in the control panel (path without prefix
unix://
at the beginning).
- Check site performance and Memcache usage statistics (d).
Older versions of DLE can work with Memcache, but their scripts have a flaw that prevents you from specifying the Memcache address as a unix socket.
- Open the file
engine/modules/functions.php
and find the following code block in it:$mcache = false; if ($config['cache_type']) { if (function_exists('memcache_connect')) { $memcache_server = explode(":", $config['memcache_server']); $mcache = @memcache_connect($memcache_server[0], $memcache_server[1]); if ($mcache AND function_exists('memcache_set_compress_threshold')) { memcache_set_compress_threshold($mcache, 20000, 0.2); } } }
- Replace the found block of code with this one:
$mcache = false; if ($config['cache_type']) { if (function_exists('memcache_connect')) { $memcache_server = explode(":", $config['memcache_server']); if ($memcache_server[0] == 'unix') { $memcache_server = array($config['memcache_server'], 0); } $mcache = @memcache_connect($memcache_server[0], $memcache_server[1]); if ($mcache AND function_exists('memcache_set_compress_threshold')) { memcache_set_compress_threshold($mcache, 20000, 0.2); } } }
- Open the site admin panel.
- Go to section "System Setup → Optimization".
- In field "Memcache server connection data" indicate
unix:///home/example/.system/memcache/socket
substituting insteadexample
title the hosting account that hosts your site. - Save your changes.
- Check site performance and Memcache usage statistics (d).