Last active
December 14, 2015 19:58
-
-
Save a9/5140423 to your computer and use it in GitHub Desktop.
Memcache
This file contains 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 | |
$memcache = new Memcache; | |
$memcache->connect('localhost', 11211) or die ("Could not connect"); | |
$version = $memcache->getVersion(); | |
echo "Server's version: " . $version . "<br/>\n"; | |
$tmp_object = new stdClass; | |
$tmp_object->str_attr = 'test'; | |
$tmp_object->int_attr = 123; | |
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server"); | |
$get_result = $memcache->get('key'); | |
var_export($get_result); | |
$memcache->close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment