PHP code example of boxunphp / memcached

1. Go to this page and download the library: Download boxunphp/memcached library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

boxunphp / memcached example snippets



$config = array(
    'servers' => array(
        array('host' => '192.168.0.1', 'port' => 11211, 'weight' => 50),
        array('host' => '192.168.0.2', 'port' => 11211, 'weight' => 50),
    ),
    'connect_timeout' => 1000, // 单位微秒
);

$mc = Memcached::getInstance($config);