getLocale(); if ( !($found = cache( "{$podcastId}_analytics_podcast_by_region_{$locale}" )) ) { $found = $this->select( '`country_code`, `region_code`, `latitude`, `longitude`' ) ->selectSum('`hits`', '`value`') ->groupBy( '`country_code`, `region_code`, `latitude`, `longitude`' ) ->where([ '`podcast_id`' => $podcastId, '`date` >' => date('Y-m-d', strtotime('-1 week')), ]) ->orderBy('`value`', 'DESC') ->findAll(); cache()->save( "{$podcastId}_analytics_podcast_by_region_{$locale}", $found, 600 ); } return $found; } }