memcache分布式记录

    xiaoxiao2021-03-26  28

    windows上开启多个memcache端口 memcached.exe -p 11211 start

    memcached.exe -p 11212 start 

    <?php $mem_conf = array(     array('host'=>'localhost', 'port'=>'11211'),     array('host'=>'localhost', 'port'=>'11212') );                         $memcache = new Memcache ( ); foreach ( $mem_conf as $v ) {     $memcache->addServer( $v ['host'], $v ['port'] ); } //  $memcache->flush(); for($i=0; $i < 10; $i++){     $memcache->set('key'.$i, $i.'value', 0, 600); } for($i=0; $i < 10; $i++){     var_dump($memcache->get('key'.$i)); } // $memStats = $memcache->getExtendedStats(); // var_dump($memStats);

    转载请注明原文地址: https://ju.6miu.com/read-661970.html

    最新回复(0)