{"action":"closed","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/10710","labels_url":"https://api.github.com/repos/laravel/framework/issues/10710/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/10710/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/10710/events","html_url":"https://github.com/laravel/framework/issues/10710","id":113064134,"number":10710,"title":"[Cache: Suggestion] Partial/Segmented caching","user":{"login":"vitor-faiante","id":469102,"avatar_url":"https://avatars.githubusercontent.com/u/469102?v=3","gravatar_id":"","url":"https://api.github.com/users/vitor-faiante","html_url":"https://github.com/vitor-faiante","followers_url":"https://api.github.com/users/vitor-faiante/followers","following_url":"https://api.github.com/users/vitor-faiante/following{/other_user}","gists_url":"https://api.github.com/users/vitor-faiante/gists{/gist_id}","starred_url":"https://api.github.com/users/vitor-faiante/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitor-faiante/subscriptions","organizations_url":"https://api.github.com/users/vitor-faiante/orgs","repos_url":"https://api.github.com/users/vitor-faiante/repos","events_url":"https://api.github.com/users/vitor-faiante/events{/privacy}","received_events_url":"https://api.github.com/users/vitor-faiante/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-23T17:28:43Z","updated_at":"2015-10-23T17:54:30Z","closed_at":"2015-10-23T17:54:30Z","body":"Hi, I do not know if this is the best place to place feature suggestions and probably will be making a fool of myself but I just thought this could be a good feature to have. So I am slightly new to Laravel and I am currently doing a project (Laravel 4.2) that I wanted to cache the view for better performance on the site. \r\nHowever I had this part of the view that had to be random stories which totally messed up the idea of caching.\r\n\r\nInitially I though of creating a partial for the area that was not dynamic and the do something like:\r\n\r\n\r\n```php\r\n\r\npublic function show($storyId)\r\n{\r\n    $story = Api::get('stories/'.$storyId); // An API we built\r\n    $storyContent = Cache::remember('story_content_'.$storyId, 60*24*7, function() use($storyId) {\r\n        return View::make('stories.storyContent', [ 'story' => $story ])->render();\r\n    });\r\n    ...\r\n    return View::make('stories.show', [ 'storyContent' => $storyContent, 'relatedStories' => $relatedStories]);\r\n}\r\n\r\n```\r\n\r\nNow this was a bit convoluted and not as beautiful looking as the rest of Laravel. I would prefer something like this in a view:\r\n\r\n```php\r\n\r\n@cache('story_content_'.$story->id, 60)\r\n    // HTML here\r\n@endcache\r\n\r\n```\r\n\r\nAlso having the capability to work with tags too would be amazing. I was told that some other frameworks have similar things like in Django and Ruby on Rails, but I know that as of now this does not yet work out of the box in Laravel. It would be a nice to have. Thanks for the time and sorry once again if I posted this suggestion in the wrong place."}}