-
-
Save linuxpld/7ed36ce5d362443f7de9633dea6e2e1e to your computer and use it in GitHub Desktop.
PHP Memcached Server Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Test default memcached server. Load, then refresh. | |
if (class_exists('Memcache')) { | |
$meminstance = new Memcache(); | |
} else { | |
$meminstance = new Memcached(); | |
} | |
$meminstance->addServer("127.0.0.1",11211); | |
$result = $meminstance->get("test"); | |
if ($result) { | |
echo $result; | |
} else { | |
echo "No matching key found. Refresh the browser to add it!"; | |
$meminstance->set("test", "Successfully retrieved the data!") 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