From: Simon H. <sim...@us...> - 2010-11-16 19:04:39
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7337/lib/database Modified Files: Tag: item_state_separation StackDBCache.php Log Message: Implemented reduceToState optimisation. To test. Index: StackDBCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBCache.php,v retrieving revision 1.12.6.2.2.3 retrieving revision 1.12.6.2.2.4 diff -C2 -d -r1.12.6.2.2.3 -r1.12.6.2.2.4 *** StackDBCache.php 9 Nov 2010 18:26:59 -0000 1.12.6.2.2.3 --- StackDBCache.php 16 Nov 2010 19:04:31 -0000 1.12.6.2.2.4 *************** *** 46,49 **** --- 46,52 ---- if($transition == NULL) { // go ahead and extend cache + //$state->trimToStateonly(); + $this->logger->debug("state in add: ".print_r($state, true)); + // add the new state $stateID = $this->addState($qID, $state, $post, $xhtml, $questionNote, $currentTotalMark, $totalPossibleMarks, $expired); *************** *** 159,162 **** --- 162,169 ---- $instance = new DisplayItem($userID, $qID, false, $seed); // non user-specific starter question + //$instance->reduceToState(); + //$logger = new Logger("STATIC deploy cache"); + //$logger->debug("state in deployCache: ".print_r($instance, true)); + // discard if this duplicates an existing instance (defined by question note) $sql = "SELECT * FROM display_cache, display_cache_sequence WHERE qID = ".$instance->getQuestionID(). *************** *** 168,171 **** --- 175,179 ---- // create a cache state $xhtml = $instance->processQuestion(NULL, true, false); + $sql = "INSERT INTO display_cache(qID, state, xhtml, questionNote, currentTotalMark, totalPossibleMarks, expired, lastActive) VALUES ($qID," . "'STATE GOES HERE'".//$this->dbSafeString($this->base64_serialize($instance)) . later... *************** *** 185,188 **** --- 193,201 ---- //$this->logger->debug('in deployCache, id='.$id); + //$logger->debug("pre-reduce size:".strlen($db->base64_serialize($instance))); + $instance->reduceToState(); + //$logger->debug("whole DI:".print_r($instance, 1)); + //$logger->debug("post-reduce size:".strlen($db->base64_serialize($instance))); + $db->query("UPDATE display_cache" . " SET state=".$db->dbSafeString($db->base64_serialize($instance)). |