缓存是一种缩短数据访问时间、减少延迟并提高输入/输出(I/O)速度的机制。 自适应表单缓存仅存储自适应表单的HTML内容和JSON结构,而不保存任何预填数据。 它有助于减少在客户端渲染自适应表单所需的时间。 它专为自适应表单而设计。
转到AEM Web控制台配置管理器,网址为 https://[server]:[port]/system/console/configMgr
.
单击 自适应表单和交互式通信Web渠道配置 以编辑其配置值。
在 编辑配置值 对话框,指定AEM实例的最大表单或文档数 Forms 服务器可以在以下位置缓存: 自适应Forms的数量 字段。 默认值为 100。
要禁用缓存,请将自适应Forms的数量字段中的值设置为 0. 当您禁用或更改缓存配置时,将重置缓存并从缓存中删除所有表单和文档。
单击 保存 以保存配置。
您的环境配置为使用缓存自适应表单和相关资产。
您还可以在Dispatcher上配置自适应表单缓存,以实现额外的性能提升。
/content/forms/[folder-structure]/[form-name].html
缓存,缓存会忽略具有模式的URL /content/dam/formsanddocument/[folder-name]/<form-name>/jcr:content
. 因此,请使用带有扩展名的URL来获得缓存的好处。http://host:port/content/forms/af/<afName>.<locale>.html
要请求自适应表单的本地化版本,而不是 http://host:port/content/forms/af/afName.html?afAcceptLang=<locale>
http://host:port/content/forms/af/<adaptivefName>.html
.http://host:port/content/forms/af/<adaptivefName>.html
、和 使用浏览器区域设置 在configuration manager中处于禁用状态时,会提供自适应表单的非本地化版本。 非本地化语言是开发自适应表单时使用的语言。 不会考虑为您的浏览器配置的区域设置(浏览器区域设置),并且会提供自适应表单的非本地化版本。http://host:port/content/forms/af/<adaptivefName>.html
、和 使用浏览器区域设置 在configuration manager中,会提供自适应表单的本地化版本(如果可用)。 本地化的自适应表单的语言基于为您的浏览器配置的区域设置(浏览器区域设置)。 它可能会导致 [仅缓存自适应表单的第一个实例]. 要防止问题在实例中发生,请参阅 故障排除.执行以下列出的步骤以在Dispatcher上启用和配置缓存自适应表单:
为环境的每个发布实例打开以下URL,并 为环境的发布实例启用刷新代理:
http://[server]:[port]]/etc/replication/agents.publish/flush.html
/invalidate
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
# Consider all HTML files stale after an activation.
/glob "*.html"
/type "allow"
}
/0002
{
# Exclude htmls present in AF directories
/glob "/content/forms/**/*.html"
/type "deny"
}
添加以上内容时:
自适应表单会保留在缓存中,直到未发布该表单的更新版本。
发布自适应表单中引用的较新版本的资源时,受影响的自适应表单会自动失效。 引用资源的自动失效有一些例外。 有关例外的解决方法,请参见 故障排除 部分。
添加以下规则dispatcher.any或自定义规则文件. 它不包括不支持缓存的URL。 例如,交互式通信。
/0000 {
/glob "*"
/type "allow"
}
## Don't cache csrf login tokens
/0001 {
/glob "/libs/granite/csrf/token.json"
/type "deny"
}
## Don't cache IC - print channel
/0002 {
/glob "/content/forms/**/channels/print.html"
/type "deny"
}
## Don't cache IC - web channel
/0003 {
/glob "/content/forms/**/channels/web.html"
/type "deny"
}
/ignoreUrlParams {
/0001 { /glob "*" /type "deny" }
# added for AEM forms specific use cases.
/0003 { /glob "dataRef" /type "allow" }
}
您的AEM环境配置为缓存自适应表单。 它会缓存所有类型的自适应表单。 如果您需要在交付缓存页面之前检查页面的用户访问权限,请参阅 缓存受保护内容.
当您通过资产浏览器选择图像或视频并将其添加到自适应表单并在资产编辑器中编辑这些图像或视频时,包含此类图像的自适应表单不会自动从Dispatcher缓存中失效。
发布图像和视频后,明确取消发布并发布引用这些资产的自适应表单。
当自适应表单URL没有任何本地化信息时,以及 使用浏览器区域设置 在启用configuration manager时,会提供自适应表单的本地化版本,并且只缓存自适应表单的第一个实例并将其交付给每个后续用户。
执行以下步骤来解决问题:
打开conf.d/httpd-dispatcher.conf或配置为在运行时加载的任何其他配置文件。
将以下代码添加到文件中并保存。 它是一个示例代码,可对其进行修改以适合您的环境。
<VirtualHost *:80>
# Set log level high during development / debugging and then turn it down to whatever is appropriate
LogLevel rewrite:trace6
# Start Rewrite Engine
RewriteEngine On
# Handle actual URL convention (just pass through)
RewriteRule "^/content/forms/af/(.*)[.](.*).html$" "/content/forms/af/$1.$2.html" [PT]
# Handle selector based redirection basded on browser language
# The Rewrite Cond(ition) is looking for the Accept-Lanague header and if found takes the first two character which most likely will be the desired language selector.
RewriteCond %{HTTP:Accept-Language} ^(..).*$ [NC]
RewriteRule "^/content/forms/af/(.*).html$" "/content/forms/af/$1.%1.html" [R]
</VirtualHost>