public function __construct() { // let's make this a singleton if (isset($memc)) { return $this; } self::$memc = new Memcache(); self::$memc->addServer(self::$host); }
<?php require_once "includes/memcache.php"; $memcache = new RR_Memcache(); $callKey = $_REQUEST['callKey']; $aResponse = array("move" => $memcache->get($callKey)); echo json_encode($aResponse);
<?php require_once "includes/memcache.php"; // do some quick setup $memcache = new RR_Memcache(); $callKey = $_REQUEST['callKey']; echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<Response><Say>"; switch ($_REQUEST['Digits']) { case 2: echo "up"; $memcache->set($callKey, "up"); break; case 4: echo "left"; $memcache->set($callKey, "left"); break; case 6: echo "right"; $memcache->set($callKey, "right"); break; case 8: echo "down"; $memcache->set($callKey, "down"); break; default: echo "pause"; $memcache->set($callKey, "pause"); break; } echo '</Say>';
<?php require_once "includes/memcache.php"; $memcache = new RR_Memcache(); $callKey = $_REQUEST['callKey']; $memcache->set($callKey, "stop"); echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> <Response> <Hangup /> </Response>