Level 36
@ronon first:
$id = 1;
$post = Cache:rembemer('posts.' . $id, 60, function() use ($id) {
return Post::find($id);
});
second: no, you need to make separate requests for each page
I have two question related to Laravels Caching System.
First: Is it possible to Cache a single post?
class PostController{
public function show(Post $post){
// Post need to be cached before it arrives here?!?
}
}
On index I can do.
$posts = Cache:rembemer('posts', 60, function(){
return Post::all();
});
Get all posts if they are not in cache.
Second:
If you execute the code from above, can you still use pagination on posts, or do you have to cache every page from pagination?
Please or to participate in this conversation.