Skip to content

Instantly share code, notes, and snippets.

@mansurali901
Created August 21, 2018 18:11
Show Gist options
  • Save mansurali901/4be611e35abc0e33a6b70831de2cb745 to your computer and use it in GitHub Desktop.
Save mansurali901/4be611e35abc0e33a6b70831de2cb745 to your computer and use it in GitHub Desktop.
A PHP Script to test memcache server
<?php
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("blah");
if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!";
$mem->set("blah", "I am data! I am held in memcached!") or die("Couldn't save anything to memcached...");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment