-
-
Save cursosdesarrolloweb/554cbaa46ec1a1fb8bcb82cd2d0143f6 to your computer and use it in GitHub Desktop.
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 | |
class Home { | |
public function __invoke(Cache $cache) { | |
// buscamos el archivo en caché, si existe lo servimos | |
$cachedFile = $cache->load("home"); | |
if ($cachedFile) return $cachedFile; | |
// En otro caso, hacemos 100 operaciones para obtener los datos necesarios | |
$view = view("home", compact("news", "tags", "authors", "ads")); | |
// ¡la próxima vez ya estará en caché! | |
$cache->save($view); | |
return $view; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment