Last active
October 15, 2015 18:01
-
-
Save Teevio/2411687a92ca64ebe4ac to your computer and use it in GitHub Desktop.
Manual Caching
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 | |
// Unique key for the cache | |
$cacheKey = 'a-key-that-you-decide'; | |
$fan = Cache::get($cacheKey); | |
// If the cache doesn't exist get data and cache | |
if (is_null($fan)) { | |
$fan = Fan::find(1); | |
$expires = 84000; | |
Cache::put($cacheKey, $fan, $expires); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment