Connect Memcached Server
Memcached Connect Options:
框架默认设置了以下 Memcached::setOption
<?php use Asf\Cache\Adapter\Memcached; $options = array('host' => array( array('127.0.0.1', 11211, 50), array('127.0.0.1', 11212, 50), ), 'timeout' => 1000, // default ); $memcached = new Memcached($options); print_r($memcached); print_r($memcached->getConnectInfo()); print_r($memcached->getHandler()); $key = 'asf_test'; var_dump($memcached->has($key)); var_dump($memcached->get($key)); echo '------------------------set/has/get', PHP_EOL; var_dump($memcached->set($key, 1)); var_dump($memcached->set('abc', 123456)); var_dump($memcached->set('xyz', 168247)); var_dump($memcached->set('username', 168247)); var_dump($memcached->set('password', 168247)); var_dump($memcached->set('cart', 168247)); var_dump($memcached->set('archive', 168247)); var_dump($memcached->has($key)); var_dump($memcached->get($key)); echo '------------------------__call: getServerList/isPersistent', PHP_EOL; var_dump($memcached->getServerList()); var_dump($memcached->isPersistent()); echo '------------------------incr/decr', PHP_EOL; var_dump($memcached->incr($key)); var_dump($memcached->decr($key)); var_dump($memcached->incr($key, 10)); var_dump($memcached->decr($key, 5)); echo '------------------------get', PHP_EOL; var_dump($memcached->get($key)); echo '------------------------del', PHP_EOL; var_dump($memcached->del($key)); echo '------------------------clear', PHP_EOL; var_dump($memcached->clear()); echo '------------------------close', PHP_EOL; var_dump($memcached->close());