#385 document_item 문제 수정

This commit is contained in:
bnu 2014-01-31 18:45:02 +09:00
parent fa48004031
commit bc3cf3f199
4 changed files with 18 additions and 24 deletions

View file

@ -195,7 +195,7 @@ class documentAdminController extends document
{
foreach($document_srl_list as $document_srl)
{
$cache_key_item = 'document_item:'.$document_srl;
$cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key_item);
}
}
@ -451,7 +451,7 @@ class documentAdminController extends document
{
foreach($document_srl_list as $document_srl)
{
$cache_key_item = 'document_item:'.$document_srl;
$cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key_item);
}
}

View file

@ -555,7 +555,7 @@ class documentController extends document
if($oCacheHandler->isSupport())
{
//remove document item from cache
$cache_key = 'document_item:'.$obj->document_srl;
$cache_key = 'document_item:'. getNumberingPath($obj->document_srl) . $obj->document_srl;
$oCacheHandler->delete($cache_key);
}
@ -646,7 +646,7 @@ class documentController extends document
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$cache_key = 'document_item:'.$document_srl;
$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key);
}

View file

@ -78,33 +78,34 @@ class documentItem extends Object
$document_item = false;
$cache_put = false;
$columnList = array();
$this->columnList = array();
// cache controll
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$cache_key = 'document_item:' . $this->document_srl;
$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
$document_item = $oCacheHandler->get($cache_key);
if($document_item !== false)
{
$document_item = (object)$document_item->getVariables();
$this->columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
}
else
{
$this->columnList = array();
$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
}
}
$args = new stdClass();
$args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocument', $args, $this->columnList);
$output = executeQuery('document.getDocument', $args, $columnList);
if($document_item === false)
{
$cache_put = true;
if(!is_object($output->data)) $document_item = new stdClass;
else $document_item = $output->data;
$document_item = $output->data;
//insert in cache
if($document_item && $oCacheHandler->isSupport())
{
$oCacheHandler->put($cache_key, $document_item);
}
}
else
{
@ -116,12 +117,6 @@ class documentItem extends Object
}
$this->setAttribute($document_item, $load_extra_vars);
//insert in cache
if($cache_put && $oCacheHandler->isSupport())
{
$oCacheHandler->put($cache_key, $this);
}
}
function setAttribute($attribute, $load_extra_vars=true)

View file

@ -136,12 +136,11 @@ class documentModel extends document
{
if(!$document_srl) return new documentItem();
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) || $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->columnListKey != serialize($columnList))
if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
{
$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
if($load_extra_vars) $this->setToAllDocumentExtraVars();
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->columnListKey = serialize($columnList);
}
if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();