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:
dragan-dan 2011-09-13 16:27:17 +00:00
parent aa1f0ceddc
commit 054a2e7e81
6 changed files with 188 additions and 38 deletions

View file

@ -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);