Failed storing data in memcached

Doesn't work the cache.

    $frontCache = new Phalcon\Cache\Frontend\Data(
        [
            "lifetime" => 86400
        ]
    );

    $cache = new Phalcon\Cache\Backend\Libmemcached(
        $frontCache,
        [
            "host" => "memcache",
            "port" => "11211",
        ]
    );

Failed storing data in memcached, error code: 47

#0 [internal function]: Phalcon\Cache\Backend\Libmemcached->save('Domain::getActu...', Object(Phalcon\Mvc\Model\Resultset\Simple), 900)
#1 [internal function]: Phalcon\Mvc\Model\Query->execute()
#2 /app/models/Domain.php(54): Phalcon\Mvc\Model::find(Array)
#3 /app/models/Domain.php(74): Domain::find(Array)
#4 /app/app.php(16): Domain::getActualDomain()
#5 [internal function]: Closure->{closure}('')
#6 /app/public/index.php(42): Phalcon\Mvc\Micro->handle('/')
#7 {main}
edited Aug '16

error 47 = MEMCACHED_SERVER_TEMPORARILY_DISABLED

http://br2.php.net/manual/en/memcached.constants.php#118557

Try to connect to your Memcached daemon via command line first, and check ps -ef | grep -i memc if you can see it in a process list.

Also firewall/iptables might be blocking access on the remote machine.



1.5k

Memcached work perfectly:

# telnet memcache 11211
Trying 172.20.0.2...
Connected to memcache.
Escape character is '^]'.
get test
END
set test 1 0 11
Hello world
STORED
get test
VALUE test 1 11
Hello world
END
quit

and from php also good:

$memcached = new Memcached();
$memcached->addServer('memcache', '11211');

$memcached->set('test', 123);
var_dump($memcached->get('test')); // dumped 123

Phalcon\Cache\Backend\Libmemcached options looks like this:

var_dump($cache->getOptions()):

array (size=4)
  'host' => string 'memcache' (length=8)
  'port' => string '11211' (length=5)
  'servers' => 
    array (size=1)
      0 => 
        array (size=3)
          'host' => string '127.0.0.1' (length=9)
          'port' => int 11211
          'weight' => int 1
  'statsKey' => string '' (length=0)


1.5k

After restarting memcached server - works. I do not know what it was. Thank you!