PHP code example of sevenlab / laravel-responsecache
1. Go to this page and download the library: Download sevenlab/laravel-responsecache library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sevenlab / laravel-responsecache example snippets
return [
/*
* Determine if the response cache middleware should be enabled.
*/
'enabled' => env('RESPONSECACHE_ENABLED', true),
/*
* Specify the tag name that will be used for the cache.
*/
'tag' => env('RESPONSECACHE_TAG', 'responsecache'),
];
// cache this route for 5 minutes
Route::get('/my-special-snowflake', 'SnowflakeController@index')->middleware('cacheResponse:5');
// cache all these routes for 10 minutes
Route::group(function() {
Route::get('/another-special-snowflake', 'AnotherSnowflakeController@index');
Route::get('/yet-another-special-snowflake', 'YetAnotherSnowflakeController@index');
})->middleware('cacheResponse:10');