| | |
| | | $this->cache = Cache::for('referrals', WEEK_IN_SECONDS); |
| | | // $this->requestCache = Cache::for('referral_requests', WEEK_IN_SECONDS)->connect('referrals', true); |
| | | $this->statsCache = Cache::for('referral_stats', WEEK_IN_SECONDS)->connect('referrals', true)->user(); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | // $this->requestCache->flush(); |
| | | $this->statsCache->flush(); |
| | | } |
| | | |
| | | $this->referralPage = $this->getReferralPageId(); |
| | | $this->settings = $this->getRewardSettings(); |
| | |
| | | public function getTopReferrers(int $limit = 10, string $period = 'all'): array |
| | | { |
| | | return $this->statsCache->remember( |
| | | $this->statsCache->generateKey(['per_page' => $limit, 'period' => $period]), |
| | | ['per_page' => $limit, 'period' => $period], |
| | | function() use ($limit, $period) { |
| | | $where = ''; |
| | | if ($period !== 'all') { |