PHP code example of klinson / laravel-cache-response

1. Go to this page and download the library: Download klinson/laravel-cache-response 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/ */

    

klinson / laravel-cache-response example snippets


    Klinson\CacheResponse\CacheResponseServiceProvider::class,
    

    'CacheResponse' => Klinson\CacheResponse\CacheResponse::class,
    

Route::get('data', 'DataController@all')->middleware('cache_response');

// 获取CacheResponse对象
cache_response()

// 获取$cache_key下的缓存返回Response对象
cache_response($cache_key)

// 获取$request下的缓存返回Response对象
cache_response($request)

// 设置缓存
cache_response($request, $response)
shell
php artisan vendor:publish --provider="Klinson\CacheResponse\CacheResponseServiceProvider"
shell
php artisan cache-response:clear