Created
April 16, 2018 23:09
-
-
Save jdc-cunningham/96c31ea6f9a6afde05d3a929e2dc0714 to your computer and use it in GitHub Desktop.
memcache set key
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 test | |
$server = 'localhost'; | |
if (!empty($_REQUEST['server'])) { | |
$server = $_REQUEST['server']; | |
} | |
$memcache = new Memcache; | |
$isMemcacheAvailable = @$memcache->connect($server); | |
// check memcache | |
if ($isMemcacheAvailable) { | |
// set a key | |
$memcache->set($name, $name_key, 0, 86400); // set for 1 day, destroy on logout | |
} | |
else { | |
echo "memcache not available"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment