setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true); $memcacheD->setOption(Memcached::OPT_CONNECT_TIMEOUT, 1000); if (! count($memcacheD->getServerList())) { if (! $memcacheD->addServers(array( array( $memcache_server, $memcache_port ) ))) { file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . ' Failed to connect memcache ' . $memcache_server . ':' . $memcache_port, FILE_APPEND); } else { file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . ' Connected memcache ' . $memcache_server . ':' . $memcache_port, FILE_APPEND); } } } else { $memcacheD = null; } /* END IF MEMCACHED */