Skip to content

Instantly share code, notes, and snippets.

@gnilchee
Created September 16, 2018 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnilchee/37698f29633d0df1b5c23e4a84626dcb to your computer and use it in GitHub Desktop.
Save gnilchee/37698f29633d0df1b5c23e4a84626dcb to your computer and use it in GitHub Desktop.
php and memcache example
<?php
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("username");
if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!\n";
$mem->set("username", "my_secret_passwd\n") or die("Couldn't save anything to memcached...\n");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment