Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTL for Route group? #28

Open
david-nguyen opened this issue Sep 13, 2016 · 4 comments
Open

TTL for Route group? #28

david-nguyen opened this issue Sep 13, 2016 · 4 comments

Comments

@david-nguyen
Copy link

Sorry if this is a basic question, is there an example of setting the TTL for a route group?

@hamony
Copy link

hamony commented Sep 16, 2016

@david-nguyen Put 'Barryvdh\HttpCache\Middleware\CacheRequests' in the $routeMiddleware and implement into Route group you need.

@david-nguyen
Copy link
Author

@khoaspark yes thanks but how would I pass the TTL to it?

@hamony
Copy link

hamony commented Sep 16, 2016

@david-nguyen You could use this code in Controller return \Response::view(Your data)
->setTtl(Anytime);

@ctf0
Copy link

ctf0 commented Aug 19, 2017

in App\Http\Controllers\Controller or whatever BaseController u have add

public function __construct()
    {
        $this->middleware(['ttl:60']);
    }

#41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants