Skip to content

Instantly share code, notes, and snippets.

@Teevio
Last active October 15, 2015 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Teevio/2411687a92ca64ebe4ac to your computer and use it in GitHub Desktop.
Save Teevio/2411687a92ca64ebe4ac to your computer and use it in GitHub Desktop.
Manual Caching
<?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