Support » Plugin: Memcached Object Cache » Configure to work with socket

  • I was trying configure to this plugin work on socket as the following:

    // ** Memcache settings **//
     $memcached_servers = array(
     	'default' => array(
     		'unix:///var/run/memcached/memcached.sock'
      // '127.0.0.1:11211'
     	)
     );

    but it do not working for me. Anyone,can you help me solved this problem?
    I had configure to work with TCP via ip 127.0.0.1 and default port 11211 and its working fine.
    In addition, I tested with some code as the following and it working fine too:

    <?php
    
    error_reporting(E_ALL);
    ini_set('display_errors', true);
    
    $mc = new Memcache;
     $mc->addServer("unix:///var/run/memcached/memcached.sock", 0);
    $ttl = 60;
    $data = "This is data";
    $key = "ABCDEDF";
    $mc->set($key, $data, 0, $ttl);
    $mcData = $mc->get($key);
    
    var_dump("Data from memcached: " . $mcData);
    
     ?>

    Thanks!

  • The topic ‘Configure to work with socket’ is closed to new replies.