PHP code example of memcachier / php-memcache-sasl
1. Go to this page and download the library: Download memcachier/php-memcache-sasl 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/ */
memcachier / php-memcache-sasl example snippets
/* connect to a server */
$m = new MemcacheSASL;
$m->addServer('127.0.0.1', '11211');
/* set timeout to 2 second */
$m->setOption(MemcacheSASL::OPT_SEND_TIMEOUT, 2000000);
$m->setOption(MemcacheSASL::OPT_RECV_TIMEOUT, 2000000);
/* set SASL username and password */
$m->setSaslAuthData('username', 'password');
/* perform some operations */
var_dump($m->add('test', '123'));
$m->delete('test');