Skip to content

Instantly share code, notes, and snippets.

@GeniJaho
Created March 5, 2022 12:26
10 - Cache results
<?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