Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:lsmcd:new_sasl [2018/08/13 19:22]
Robert Perper [Enable SASL in Your Configuration File]
litespeed_wiki:lsmcd:new_sasl [2019/03/28 17:59] (current)
Robert Perper [Configure for PHP]
Line 67: Line 67:
 Some notes for all programming environments:​ Some notes for all programming environments:​
    * You must instantiate an instance of the Memcached object (Memcache no longer works).    * You must instantiate an instance of the Memcached object (Memcache no longer works).
-   * You must use the binary protocol.+   * You must use the binary protocol ​(must be the first Memcached method). 
 +   * You must turn off compression.
    * You must make the call to set the SASL authentication information (user/​password) before you add the server.    * You must make the call to set the SASL authentication information (user/​password) before you add the server.
-   * Once you add the server successfully,​ you can perform all standard Memcached operations (get, put, etc.).+   * Once you add the server successfully,​ you can perform all standard Memcached operations (get, put, getStats, etc.).
  
 <​code>​ <​code>​
 <?php <?php
 $mem_var = new Memcached();​ $mem_var = new Memcached();​
-$mem_var->​setSaslAuthData('​user',​ '​password'​);​ 
 $mem_var->​setOption(Memcached::​OPT_BINARY_PROTOCOL,​ true); $mem_var->​setOption(Memcached::​OPT_BINARY_PROTOCOL,​ true);
 $mem_var->​setOption(Memcached::​OPT_COMPRESSION,​ false); $mem_var->​setOption(Memcached::​OPT_COMPRESSION,​ false);
 +$mem_var->​setSaslAuthData('​user',​ '​password'​);​
 $mem_var->​addServer("​127.0.0.1",​ 11211); $mem_var->​addServer("​127.0.0.1",​ 11211);
 $response = $mem_var->​get("​SampleKey"​);​ $response = $mem_var->​get("​SampleKey"​);​
  • Admin
  • Last modified: 2018/08/13 19:22
  • by Robert Perper