frosh/http-cache-ip-exclude

从 Shopware HTTP 缓存中排除 IP

1.0.0 2019-01-17 12:35 UTC

This package is auto-updated.

Last update: 2024-08-25 17:49:39 UTC


README

Travis CI Download @ Community Store Join the chat at https://gitter.im/FriendsOfShopware/Lobby

此插件配置 Shopware 使用一个自定义的存储来使用 HTTP 缓存,该存储包括一个 IP 过滤器,从而有效地跳过提供的 IP 地址的 HTTP 缓存交付。这在没有其他选择的情况下,对于生产环境中的测试/调试非常有用。

安装

  • 将此存储库克隆到 Shopware 安装 custom/plugins 目录下的 FroshHttpCacheIpExclude 文件夹中。
  • 通过 Shopware 后端中的插件管理器安装插件。

使用 composer 安装

  • 切换到 shopware 的根安装目录
  • 运行命令 composer require frosh/http-cache-ip-exclude,并通过插件管理器安装和激活插件

使用方法

安装后,您的 config.php 应该看起来像这样

require_once __DIR__ . '/custom/plugins/FroshHttpCacheIpExclude/Components/IpExcludeStore.php';
return array (
  'db' => 
  array (
    // ...
  ),
  // ...
  'httpcache' => 
  array (
    'storeClass' => 'FroshHttpCacheIpExclude\\Components\\IpExcludeStore',
    'extended' => 
    array (
      'passedStoreClass' => NULL,
      'ipExcludes' => 
      array (
      ),
      'paramExcludes' => 
      array (
      ),
      'cookieExcludes' => 
      array (
      ),
    ),
  ),
);

使用 extended 下的 passedStoreClass 属性提供自定义存储类,然后将其传递给 IpExcludeStore

此外,您还可以使用 paramExcludes 来定义 GET 参数的列表,或者使用 cookieExcludes 来定义一个 cookies 列表,如果设置了这些 cookies,则会绕过缓存。

使用 extended 下的 ipExcludes 属性来定义一个 IP 地址数组,这些地址将不会提供缓存页面。