mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Fix #785 excessive use of cache by counter module
This commit is contained in:
parent
f7d19ea47c
commit
fe489420ad
1 changed files with 12 additions and 16 deletions
|
|
@ -25,27 +25,23 @@ class counterModel extends counter
|
||||||
*/
|
*/
|
||||||
function isLogged($site_srl = 0)
|
function isLogged($site_srl = 0)
|
||||||
{
|
{
|
||||||
|
$date = date('Ymd');
|
||||||
|
if (isset($_SESSION['counter_logged'][$date]) && $_SESSION['counter_logged'][$date])
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->regdate = date('Ymd');
|
$args->regdate = $date;
|
||||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
$iplogged = false;
|
$iplogged = $output->data->count ? true : false;
|
||||||
$cache_key = 'counter:' . $site_srl . '_' . str_replace(array('.', ':'), '-', $args->ipaddress);
|
if ($iplogged)
|
||||||
$group_key = 'counterIpLogged_' . $args->regdate;
|
|
||||||
$iplogged = Rhymix\Framework\Cache::get($group_key . ':' . $cache_key);
|
|
||||||
|
|
||||||
if(!$iplogged)
|
|
||||||
{
|
{
|
||||||
$output = executeQuery('counter.getCounterLog', $args);
|
$_SESSION['counter_logged'][$date] = true;
|
||||||
if($output->data->count) $iplogged = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($iplogged)
|
|
||||||
{
|
|
||||||
Rhymix\Framework\Cache::set($group_key . ':' . $cache_key, $iplogged, 0, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $iplogged;
|
return $iplogged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue