PHP code example of rose1988c / laravel-routecache-middleware

1. Go to this page and download the library: Download rose1988c/laravel-routecache-middleware 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/ */

    

rose1988c / laravel-routecache-middleware example snippets


"rose1988c/laravel-routecache-middleware":"dev-master"

or

composer 
`
    Route::group(['middleware' => 'cache:10'], function(){
        Route::get('/', 'HomeController@index');
    });
`
    php artisan vendor:publish
`
    // set cache lifetime 10
    Route::group(['middleware' => 'cache:10'], function(){
        Route::get('/', 'DemoController@index');
    });
`
    Route::group(['middleware' => 'flush'], function(){
        Route::any('switchP', 'HomeController@switchP');
    });

    Route::group(['middleware' => 'flush:ref'], function(){
        Route::any('switchP', 'HomeController@switchP');
    });

    // test url: http://192.168.141.129:8084/cleanCache?flushurl=http://192.168.141.129:8084/wealthbalance
    // result  : ok
    Route::group(['middleware' => 'flush:url'], function(){
        Route::any('cleanCache', function(){
            echo 'hello, world!';
        });
    });