/10-cache-results.php Secret
Created
March 5, 2022 12:26
10 - Cache results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
$stats = Cache::remember( | |
'statsByMonth', | |
// Clears cache at the start of next month | |
now()->addMonth()->startOfMonth()->startOfDay(), | |
function () { | |
return $this->getStatsByMonth(); | |
} | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment