mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 00:32:15 +09:00
cache improvements 2
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9142 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aa1f0ceddc
commit
054a2e7e81
6 changed files with 188 additions and 38 deletions
|
|
@ -156,7 +156,9 @@
|
|||
foreach($document_srl_list as $document_srl)
|
||||
{
|
||||
$cache_key = 'object:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
$oCacheHandler->delete($cache_key);
|
||||
$cache_key_item = 'object_document_item:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key_item);
|
||||
}
|
||||
$cache_object = $oCacheHandler->get('module_list_documents');
|
||||
foreach ($cache_object as $object){
|
||||
|
|
@ -298,6 +300,8 @@
|
|||
{
|
||||
$cache_key = 'object:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
$cache_key_item = 'object_document_item:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key_item);
|
||||
}
|
||||
$cache_object = $oCacheHandler->get('module_list_documents');
|
||||
foreach ($cache_object as $object){
|
||||
|
|
|
|||
|
|
@ -416,6 +416,9 @@ class documentController extends document {
|
|||
$oCacheHandler->delete($cache_key_object);
|
||||
}
|
||||
$oCacheHandler->delete('module_list_documents');
|
||||
//remove document item from cache
|
||||
$cache_key = 'object_document_item:'.$obj->document_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
@ -500,6 +503,8 @@ class documentController extends document {
|
|||
$oCacheHandler->delete($cache_key_object);
|
||||
}
|
||||
$oCacheHandler->delete('module_list_documents');
|
||||
$cache_key = 'object_document_item:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -27,10 +27,19 @@
|
|||
|
||||
function _loadFromDB($load_extra_vars = true) {
|
||||
if(!$this->document_srl) return;
|
||||
|
||||
$args->document_srl = $this->document_srl;
|
||||
$output = executeQuery('document.getDocument', $args, $this->columnList);
|
||||
|
||||
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object_document_item:'.$this->document_srl;
|
||||
$output = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$output) {
|
||||
$args->document_srl = $this->document_srl;
|
||||
$output = executeQuery('document.getDocument', $args, $this->columnList);
|
||||
//insert in cache
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
|
||||
}
|
||||
$this->setAttribute($output->data,$load_extra_vars);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,12 +293,23 @@
|
|||
* @brief Get a list of groups which the member_srl belongs to
|
||||
**/
|
||||
function getMemberGroups($member_srl, $site_srl = 0, $force_reload = false) {
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object_member_groups:'.$member_srl.'_'.$site_srl;
|
||||
$output = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
static $member_groups = array();
|
||||
if(!$member_groups[$member_srl][$site_srl] || $force_reload) {
|
||||
$args->member_srl = $member_srl;
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('member.getMemberGroups', $args);
|
||||
if(!$output){
|
||||
$args->member_srl = $member_srl;
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('member.getMemberGroups', $args);
|
||||
//insert in cache
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
|
||||
}
|
||||
if(!$output->data) return array();
|
||||
|
||||
|
||||
$group_list = $output->data;
|
||||
if(!is_array($group_list)) $group_list = array($group_list);
|
||||
|
|
|
|||
|
|
@ -52,10 +52,20 @@
|
|||
$args->called_position = $called_position;
|
||||
|
||||
$output = executeQuery('module.insertTrigger', $args);
|
||||
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$trigger_name.'_'.$called_position;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
// Delete all the files which contain trigger information
|
||||
FileHandler::removeFilesInDir("./files/cache/triggers");
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,6 +80,15 @@
|
|||
$args->called_position = $called_position;
|
||||
|
||||
$output = executeQuery('module.deleteTrigger', $args);
|
||||
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$trigger_name.'_'.$called_position;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
// Remove the trigger cache
|
||||
FileHandler::removeFilesInDir('./files/cache/triggers');
|
||||
|
||||
|
|
@ -131,6 +150,13 @@
|
|||
}
|
||||
|
||||
return $this->insertModuleConfig($module, $origin_config, $site_srl);
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:module_config:module_'.$module.'_site_srl_'.$site_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -160,8 +186,19 @@
|
|||
|
||||
$output = executeQuery('module.deleteModulePartConfig', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object_module_part_config:'.$module.'_'.$module_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
$output = executeQuery('module.insertModulePartConfig', $args);
|
||||
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -407,7 +444,15 @@
|
|||
$args->skin_vars = $skin_vars;
|
||||
$output = executeQuery('module.updateModuleSkinVars', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object_module_skin_vars:'.$module_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -524,6 +569,15 @@
|
|||
**/
|
||||
function deleteModuleSkinVars($module_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object_module_skin_vars:'.$module_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
|
||||
return executeQuery('module.deleteModuleSkinVars', $args);
|
||||
}
|
||||
|
||||
|
|
@ -550,6 +604,13 @@
|
|||
function deleteModuleExtraVars($module_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
return executeQuery('module.deleteModuleExtraVars', $args);
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:module_extra_vars_'.$module_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -311,9 +311,18 @@
|
|||
* @brief Get a list of all triggers on the trigger_name
|
||||
**/
|
||||
function getTriggers($trigger_name, $called_position) {
|
||||
$args->trigger_name = $trigger_name;
|
||||
$args->called_position = $called_position;
|
||||
$output = executeQueryArray('module.getTriggers',$args);
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object:'.$trigger_name.'_'.$called_position;
|
||||
$output = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$output) {
|
||||
$args->trigger_name = $trigger_name;
|
||||
$args->called_position = $called_position;
|
||||
$output = executeQueryArray('module.getTriggers',$args);
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
|
||||
}
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
|
|
@ -913,14 +922,28 @@
|
|||
* Global configuration is used to manage board, member and others
|
||||
**/
|
||||
function getModuleConfig($module, $site_srl = 0) {
|
||||
if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) {
|
||||
$args->module = $module;
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('module.getModuleConfig', $args);
|
||||
$config = unserialize($output->data->config);
|
||||
$GLOBALS['__ModuleConfig__'][$site_srl][$module] = $config;
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object:module_config:module_'.$module.'_site_srl_'.$site_srl;
|
||||
$config = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
return $GLOBALS['__ModuleConfig__'][$site_srl][$module];
|
||||
if(!$config) {
|
||||
if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) {
|
||||
$args->module = $module;
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('module.getModuleConfig', $args);
|
||||
$config = unserialize($output->data->config);
|
||||
if(!$config) $config = 'empty_module_config';
|
||||
//insert in cache
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$config);
|
||||
$GLOBALS['__ModuleConfig__'][$site_srl][$module] = $config;
|
||||
}
|
||||
return $GLOBALS['__ModuleConfig__'][$site_srl][$module];
|
||||
} elseif($config == 'empty_module_config') {
|
||||
return;
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -928,14 +951,29 @@
|
|||
* Manage mid configurations which depend on module
|
||||
**/
|
||||
function getModulePartConfig($module, $module_srl) {
|
||||
if(!$GLOBALS['__ModulePartConfig__'][$module][$module_srl]) {
|
||||
$args->module = $module;
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('module.getModulePartConfig', $args);
|
||||
$config = unserialize($output->data->config);
|
||||
$GLOBALS['__ModulePartConfig__'][$module][$module_srl] = $config;
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object_module_part_config:'.$module.'_'.$module_srl;
|
||||
$config = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$config) {
|
||||
if(!$GLOBALS['__ModulePartConfig__'][$module][$module_srl]) {
|
||||
$args->module = $module;
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('module.getModulePartConfig', $args);
|
||||
$config = unserialize($output->data->config);
|
||||
if(!$config) $config = 'empty_module_config';
|
||||
//insert in cache
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$config);
|
||||
$GLOBALS['__ModulePartConfig__'][$module][$module_srl] = $config;
|
||||
}
|
||||
return $GLOBALS['__ModulePartConfig__'][$module][$module_srl];
|
||||
} elseif($config == 'empty_module_config') {
|
||||
return;
|
||||
}
|
||||
return $config;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1185,15 +1223,28 @@
|
|||
* Extra information, not in the modules table
|
||||
**/
|
||||
function getModuleExtraVars($module_srl) {
|
||||
if(is_array($module_srl)) $module_srl = implode(',',$module_srl);
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQueryArray('module.getModuleExtraVars',$args);
|
||||
if(!$output->toBool() || !$output->data) return;
|
||||
|
||||
$vars = array();
|
||||
foreach($output->data as $key => $val) {
|
||||
if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
|
||||
$vars[$val->module_srl]->{$val->name} = $val->value;
|
||||
if(is_array($module_srl)) $module_srl = implode(',',$module_srl);
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object:module_extra_vars_'.$module_srl;
|
||||
$vars = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$vars) {
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQueryArray('module.getModuleExtraVars',$args);
|
||||
if(!$output->toBool() || !$output->data) {
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,'empty_extra_vars');
|
||||
return;
|
||||
}
|
||||
$vars = array();
|
||||
foreach($output->data as $key => $val) {
|
||||
if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
|
||||
$vars[$val->module_srl]->{$val->name} = $val->value;
|
||||
}
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$vars);
|
||||
} elseif($vars == 'empty_extra_vars') {
|
||||
return;
|
||||
}
|
||||
return $vars;
|
||||
}
|
||||
|
|
@ -1216,9 +1267,18 @@
|
|||
**/
|
||||
function syncSkinInfoToModuleInfo(&$module_info) {
|
||||
if(!$module_info->module_srl) return;
|
||||
|
||||
$args->module_srl = $module_info->module_srl;
|
||||
$output = executeQueryArray('module.getModuleSkinVars',$args);
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
$cache_key = 'object_module_skin_vars:'.$module_info->module_srl;
|
||||
$output = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
if(!$output) {
|
||||
$args->module_srl = $module_info->module_srl;
|
||||
$output = executeQueryArray('module.getModuleSkinVars',$args);
|
||||
//insert in cache
|
||||
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
|
||||
}
|
||||
if(!$output->toBool() || !$output->data) return;
|
||||
|
||||
foreach($output->data as $val) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue