bagisto/bagisto-varnish

dev-master 2022-04-29 13:53 UTC

This package is auto-updated.

Last update: 2024-08-29 06:07:43 UTC


README

Bagisto E-commerce 配置 Varnish。

注意:此配置仅适用于 Bagisto E-commerce。如需,您可以按需进行自定义。

需求

  • 您需要在系统中设置 Varnish 6。

  • vcls/6.0.vcl 文件的全部内容复制到 /etc/varnish/default.vcl

  • 重启您的 Varnish 服务器。

安装

  • 运行 composer require bagisto/bagisto-varnish

  • 之后,您的路由将可用 cacheable 中间件。将此 cacheable 中间件用于您想要缓存的路线。

  • packages/Webkul/Shop/src/Routes/store-front-routes.php 中,在 middleware 键中添加 cacheable

    # File: packages/Webkul/Shop/src/Routes/store-front-routes.php
    ...
    Route::group(['middleware' => ['web', 'locale', 'theme', 'currency', 'cacheable']], function () {
      ...
    });
    ...
  • packages/Webkul/Velocity/src/Routes/front-routes.php 中,在 middleware 键中添加 cacheable

    # File: packages/Webkul/Velocity/src/Routes/front-routes.php
    ...
    Route::group(['middleware' => ['web', 'locale', 'theme', 'currency', 'cacheable']], function () {
      ...
    });
    ...
  • 运行 php artisan optimize:clear