Easier cache for Laravel3
Gets an item from the cache, if not found cache the second param which expires till never.
Cache::sear('posts', function(){
return Post::all();
});
Just thought people might want to know such easier method exists. Long cut:
Cache::get('posts', function(){
$posts = Post::all();
Cache::forever('posts', $posts);
return $posts;
});
Written by Cyrus David
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#