首页 > 解决方案 > AEM Dispatcher 缓存规则

问题描述

我想添加一个缓存规则来缓存具有给定 url/路径的多个扩展。

样本:

/rules

  /0100
  {
   /url "/urlpath/*"
   /type "allow"
   /extension '(json|xml|html|clientlibs|css|gif|ico|js|png|swf|jpe?g|woff2?)'
  }

这是有效的吗?

标签: cachingaemdispatcher

解决方案


您必须遵循指定要缓存的文档的要求:

/rules 属性中的每个项目都包含一个 glob 模式和一个类型:

The glob pattern is used to match the path of the document.
The type indicates whether to cache the documents that match the glob pattern. 
The value can be either allow (to cache the document) or
deny (to always render the document).

看起来您正在尝试在缓存部分中使用过滤规则的语法。我认为您需要使用与使用通配符的 URL 和扩展名匹配的 glob 模式,因此您可能需要使用多个规则。


推荐阅读