Update references to CacheHandler in several modules

This commit is contained in:
Kijin Sung 2016-04-18 00:55:29 +09:00
parent 050a507707
commit 2f234dfad1
11 changed files with 39 additions and 144 deletions

View file

@ -31,13 +31,9 @@ class counterModel extends counter
$args->site_srl = $site_srl;
$iplogged = false;
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$object_key = 'counter:' . $site_srl . '_' . str_replace(array('.', ':'), '-', $args->ipaddress);
$cache_key = $oCacheHandler->getGroupKey('counterIpLogged_' . $args->regdate, $object_key);
$iplogged = $oCacheHandler->get($cache_key);
}
$cache_key = 'counter:' . $site_srl . '_' . str_replace(array('.', ':'), '-', $args->ipaddress);
$group_key = 'counterIpLogged_' . $args->regdate;
$iplogged = Rhymix\Framework\Cache::get($cache_key, $group_key);
if($iplogged === false)
{
@ -45,9 +41,9 @@ class counterModel extends counter
if($output->data->count) $iplogged = TRUE;
}
if($iplogged && $oCacheHandler->isSupport())
if($iplogged)
{
$oCacheHandler->put($cache_key, $iplogged);
Rhymix\Framework\Cache::set($cache_key, $iplogged, 0, $group_key);
}
return $iplogged;
@ -64,15 +60,10 @@ class counterModel extends counter
$args = new stdClass;
$args->regdate = date('Ymd');
$insertedTodayStatus = false;
$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
if($oCacheHandler->isSupport())
{
$cache_key = 'counter:insertedTodayStatus:' . $site_srl . '_' . $args->regdate;
$insertedTodayStatus = $oCacheHandler->get($cache_key);
}
$cache_key = 'counter:insertedTodayStatus:' . $site_srl . '_' . $args->regdate;
$insertedTodayStatus = Rhymix\Framework\Cache::get($cache_key);
if($insertedTodayStatus === false)
if(!$insertedTodayStatus)
{
if($site_srl)
{
@ -86,11 +77,11 @@ class counterModel extends counter
$insertedTodayStatus = !!$output->data->count;
if($insertedTodayStatus && $oCacheHandler->isSupport())
if($insertedTodayStatus)
{
$oCacheHandler->put($cache_key, TRUE);
Rhymix\Framework\Cache::set($cache_key, true);
$_old_date = date('Ymd', strtotime('-1 day'));
$oCacheHandler->delete('counter:insertedTodayStatus:' . $site_srl . '_' . $_old_date);
Rhymix\Framework\Cache::delete('counter:insertedTodayStatus:' . $site_srl . '_' . $_old_date);
}
}