'; ?> DomCore Demos, a WebAbility® Network Project
« Back to the index

\core\WASHM example

"; echo "DomCore version ".\core\WADebug::VERSION."
"; echo "HTML API ? ".(\core\WADebug::getHTMLAPI()?'Yes':'No')."
"; echo "OS Type ? ".(\core\WADebug::getOSType()==\core\WADebug::WINDOWS?'Windows':(\core\WADebug::getOSType()==\core\WADebug::UNIX?'Unix':'Mac'))."
"; echo "
"; // Start the SHM with 20Mb default size and default ID $SHM = new \core\WASHM(); echo << Add or modify a shared memory variable
Empty the shared memory



EOF; $option = isset($_GET['option'])?$_GET['option']:null; switch($option) { case 1: $name = isset($_GET['name'])?$_GET['name']:null; $value = null; if ($name) $value = htmlentities($SHM->read(rawurldecode($name)), ENT_COMPAT, 'UTF-8'); $vname = htmlentities($name, ENT_COMPAT, 'UTF-8'); echo << Name:
Value:





EOF; break; case 2: $name = isset($_GET['name'])?$_GET['name']:null; $value = isset($_GET['value'])?$_GET['value']:null; if ($name) { $SHM->write($name, $value); } break; case 3: $name = isset($_GET['name'])?$_GET['name']:null; $SHM->delete($name); break; case 4: $SHM->flush(); break; } $m = $SHM->size(); echo "Used: {$m['used']}, free: {$m['free']}
"; $c = $SHM->content(); foreach($c as $name => $link) { echo 'Variable: ' . htmlentities($name, ENT_COMPAT, 'UTF-8') . ": pointer: {$link['p']}, last read: ". date('Y/m/d H:i:s', $link['r']) . ", last write: " . date('Y/m/d H:i:s', $link['w']) . ' [Modify] [Delete]
' . 'Value: ' . htmlentities(print_r($SHM->read($name), true), ENT_COMPAT, 'UTF-8') . '

'; } ?>



« Back to the index