Online Snippets Library

Query Cache In Laravel

To Cache the result of query in laravel,we will use remember method.

$employee = DB::table('employee')->remember(5)->get();

In above example,results of the query will be cached for five minutes.While query results are cached, the query will not be run against the database, and the results will be came from the default cache driver.