Update references to CacheHandler in document module

This commit is contained in:
Kijin Sung 2016-04-18 01:42:33 +09:00
parent 2f234dfad1
commit 2e98962264
4 changed files with 47 additions and 135 deletions

View file

@ -775,15 +775,9 @@ class documentController extends document
FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
$output->add('document_srl',$obj->document_srl);
//remove from cache
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
//remove document item from cache
$cache_key = 'document_item:'. getNumberingPath($obj->document_srl) . $obj->document_srl;
$oCacheHandler->delete($cache_key);
}
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($obj->document_srl) . $obj->document_srl);
return $output;
}
@ -919,13 +913,7 @@ class documentController extends document
$oDB->commit();
//remove from cache
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key);
}
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
return $output;
}
@ -1080,13 +1068,7 @@ class documentController extends document
$oDB->commit();
// Clear cache
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$cache_key = 'document_item:'. getNumberingPath($oDocument->document_srl) . $oDocument->document_srl;
$oCacheHandler->delete($cache_key);
}
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($oDocument->document_srl) . $oDocument->document_srl);
return $output;
}
@ -1162,13 +1144,8 @@ class documentController extends document
$oDB->commit();
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
//remove document item from cache
$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key);
}
//remove document item from cache
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
// Register session
if(!$_SESSION['banned_document'][$document_srl] && Context::getSessionStatus())
@ -1219,14 +1196,7 @@ class documentController extends document
$output = executeQuery('document.updateDocumentExtraVar', $obj);
}
$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
if($oCacheHandler->isSupport())
{
$object_key = 'module_document_extra_keys:'.$module_srl;
$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$oCacheHandler->delete($cache_key);
}
Rhymix\Framework\Cache::delete("module_document_extra_keys:$module_srl", 'site_and_module');
return $output;
}
@ -1282,14 +1252,7 @@ class documentController extends document
$oDB->commit();
$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
if($oCacheHandler->isSupport())
{
$object_key = 'module_document_extra_keys:'.$module_srl;
$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$oCacheHandler->delete($cache_key);
}
Rhymix\Framework\Cache::delete("module_document_extra_keys:$module_srl", 'site_and_module');
return new Object();
}
@ -1442,13 +1405,8 @@ class documentController extends document
$oDB->commit();
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
//remove document item from cache
$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key);
}
//remove document item from cache
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
// Return result
$output = new Object();
@ -1617,13 +1575,8 @@ class documentController extends document
$args->update_order = -1*getNextSequence();
$args->last_updater = $last_updater;
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
//remove document item from cache
$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key);
}
// remove document item from cache
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
}
return executeQuery('document.updateCommentCount', $args);
@ -1641,13 +1594,8 @@ class documentController extends document
$args->document_srl = $document_srl;
$args->trackback_count = $trackback_count;
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
//remove document item from cache
$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
$oCacheHandler->delete($cache_key);
}
// remove document item from cache
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
return executeQuery('document.updateTrackbackCount', $args);
}
@ -1752,27 +1700,25 @@ class documentController extends document
if(!$output->toBool()) return $output;
$this->makeCategoryFile($category_info->module_srl);
// remvove cache
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
// remove cache
$page = 0;
while(true)
{
$page = 0;
while(true) {
$args = new stdClass();
$args->category_srl = $category_srl;
$args->list_count = 100;
$args->page = ++$page;
$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
$args = new stdClass();
$args->category_srl = $category_srl;
$args->list_count = 100;
$args->page = ++$page;
$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
if($output->data == array())
break;
if($output->data == array())
{
break;
}
foreach($output->data as $val)
{
//remove document item from cache
$cache_key = 'document_item:'. getNumberingPath($val->document_srl) . $val->document_srl;
$oCacheHandler->delete($cache_key);
}
foreach($output->data as $val)
{
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($val->document_srl) . $val->document_srl);
}
}