Last Updated: September 09, 2019
· vohof

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;