2.14.13.2. Configuring Memcache(d) in DLE

Setting method Memcache(d) differs in different DLE versions.

  1. Open the site admin panel.
  2. Go to section «Script settings → System Setup».
  3. Switch to tab «Optimization».
  4. 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).
  5. 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.
  1. 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);
            }
        }
    }
  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);
            }
        }
    }
  3. Open the site admin panel.
  4. Go to section «System Setup → Optimization».
  5. In field «Memcache server connection data» indicate unix:///home/example/.system/memcache/socketsubstituting instead example title the hosting account that hosts your site.
  6. Save your changes.
  7. Check site performance and Memcache usage statistics (d).
Content