如何强制调度程序cachingURL与获取参数

正如我在阅读这些链接后明白的:

如何找出调度程序caching的内容?

http://docs.adobe.com/docs/en/dispatcher.html

The Dispatcher always requests the document directly from the AEM instance in the following cases: If the HTTP method is not GET. Other common methods are POST for form data and HEAD for the HTTP header. If the request URI contains a question mark "?". This usually indicates a dynamic page, such as a search result, which does not need to be cached. The file extension is missing. The web server needs the extension to determine the document type (the MIME-type). The authentication header is set (this can be configured) 

但我想caching带有参数的url。

如果我曾经要求myUrl/?p1=1&p2=2&p3=3

那么下一个对myUrl/?p1=1&p2=2&p3=3请求必须从调度caching中提供,但是myUrl/?p1=1&p2=2&p3=3&newParam=newValue应该首次由CQ服务,

我认为config /ignoreUrlParams是你正在寻找的。 它可以使用白名单查询参数,这些参数用于确定页面是否从缓存中缓存/传递。

有关详细信息,请参阅http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Ignoring%20URL%20Parameters

缓存包含查询字符串的请求是不可能的。 这样的调用被认为是动态的,因此不应该期望缓存它们。

另一方面,如果您确定这样的请求应该被缓存,导致您的应用程序/功能被查询驱动,您可以通过这种方式进行处理。

  1. 添加Apache重写规则,将移动给定参数的查询字符串到选择器
  2. (可选)添加一个CQ过滤器,将识别选择器并将其移回查询字符串

选择器可以用一个方法来构建: key_value但是在这里可以传递一些约束。

你可以用Apache重写,但这不是理想的做法。 你会打破AEM使用的模式。

而是使用选择器和扩展。 例如,而不是server.com/mypage.html?somevalue=true,请使用:server.com/mypage.myvalue-true.html

你将需要做的大部分事情会得到缓存将这样工作就好了。 如果你给我更多关于你的要求和你想要达到的细节,我可以帮你完善解决方案。