set("some.key", "Some value"); // As does get echo $shm->get("some.key")."\n"; // To make sure a value isn't modified while you are modifying it, use the third // parameter to set... // // Let's start at 123 $shm->set("some.counter", 123); $counter = $shm->get("some.counter"); echo "Counter is: ".$counter."\n"; // And attempt to increase it $shm->set("some.counter", $counter + 1, true); $counter = $shm->get("some.counter"); echo "Counter is: ".$counter."\n"; // If the value is modified, the call will fail $shm2 = new SharedData($key); $shm2->set("some.counter", 345); if (!$shm->set("some.counter", $counter + 1, true)) { echo "some.counter has been modified since last read\n"; } $shm->destroy();