PHP code example of pxianyu / laravel-cache

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

    

pxianyu / laravel-cache example snippets




return [
    'extend' => function(\Illuminate\Cache\CacheManager $cache) {
        $cache->extend('mongo', function () use ($cache) {
           return $cache->repository(new MongoStore);
        });
    }
];


use Webman\Route;

Route::get('/example', function () {
    //
})->middleware([
    \WebmanTech\LaravelCache\Middleware\ThrottleRequestsFactory::class,
]);

Route::get('/example2', function () {
    //
})->middleware([
    new \WebmanTech\LaravelCache\Middleware\ThrottleRequestsFactory([
        'limiter_for' => 'upload', // 需要在 rate_limiter.php 中配置 upload 的 for
    ]),
]);