Add caching to ModuleModel::getModuleInfoByDocumentSrl()

This commit is contained in:
Kijin Sung 2020-10-02 01:52:31 +09:00
parent 397c9ef788
commit a25497c567
4 changed files with 23 additions and 5 deletions

View file

@ -173,11 +173,22 @@ class moduleModel extends module
*/
public static function getModuleInfoByDocumentSrl($document_srl)
{
$args = new stdClass();
$args->document_srl = $document_srl;
$output = executeQuery('module.getModuleInfoByDocument', $args);
self::_applyDefaultSkin($output->data);
return self::addModuleExtraVars($output->data);
$document_srl = intval($document_srl);
$module_info = Rhymix\Framework\Cache::get('site_and_module:document_srl:' . $document_srl);
if (!$module_info)
{
$args = new stdClass();
$args->document_srl = $document_srl;
$output = executeQuery('module.getModuleInfoByDocument', $args);
$module_info = $output->data;
if ($module_info)
{
Rhymix\Framework\Cache::set('site_and_module:document_srl:' . $document_srl, $module_info, 0, true);
}
}
self::_applyDefaultSkin($module_info);
return self::addModuleExtraVars($module_info);
}
/**