<?php /* * These functions provide caching functionality for game entities. * * It's fairly trivial to replace the storage mechanism (currently arrays in the Game object, itself) * with something more robust (garbage collection, separate from process, etc.) like APC or memcached. * */ function getCharMem($entityID) { global $game; $c = $game->getCharacter($entityID); // You'd want to do some checking to make sure you have a good object and, // // if not, load it before returning... // return $c; } function setCharMem($c) { global $game; return $game->addCharacter($c); } function getRoomMem($entityID) { global $game; $r = $game->getRoom($entityID); // You'd want to do some checking to make sure you have a good object and, // // if not, load it before returning... // return $r; } function setRoomMem($c) { global $game; return $game->addRoom($c); } ?>