Skip to content

Instantly share code, notes, and snippets.

@glynrob
Created September 6, 2012 22:08
Show Gist options
  • Save glynrob/3660740 to your computer and use it in GitHub Desktop.
Save glynrob/3660740 to your computer and use it in GitHub Desktop.
Check connection to memcache server
$memcache = new Memcache;
$memcache->connect("localhost",11211);
echo "Server's version: " . $memcache->getVersion() . "<br />\n";
$data = 'This is working';
$memcache->set("key",$data,false,10);
echo "cache expires in 10 seconds<br />\n";
echo "Data from the cache:<br />\n";
var_dump($memcache->get("key"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment