快取是一種縮短資料存取時間、減少延遲並改善輸入/輸出(I/O)速度的機制。 適用性表單快取僅會儲存適用性表單的HTML內容和JSON結構,而不儲存任何預先填入的資料。 有助於縮短在用戶端上轉譯最適化表單所需的時間。 專為最適化表單而設計。
前往https://[server]:[port]/system/console/configMgr
的AEM Web主控台組態管理器。
按一下「適用性表單和互動式通訊Web通道配置」以編輯其配置值。
在編輯配置值對話框中,在Number of Adaptive Forms欄位中指定AEM Forms伺服器實例可快取的表單或文檔數上限。 預設值為 100。
若要停用快取,請將「適用性Forms數量」欄位中的值設為0。 當禁用或更改快取配置時,將重置快取,並從快取中刪除所有表單和文檔。
按一下儲存以儲存設定。
您的環境已設定為使用快取最適化表單和相關資產。
您也可以在Dispatcher設定最適化表單快取,以提升效能。
/content/forms/[folder-structure]/[form-name].html
的URL時會忽略模式為/content/dam/formsanddocument/[folder-name]/<form-name>/jcr:content
的URL。 因此,請使用具有擴充功能的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
,且停用設定管理器中的使用瀏覽器地區設定時,會提供最適化表單的非本地化版本。 非本地化語言是開發最適化表單時使用的語言。 未考慮為瀏覽器設定的地區設定(瀏覽器地區設定),且會提供最適化表單的非本地化版本。http://host:port/content/forms/af/<adaptivefName>.html
,且啟用設定管理器中的使用瀏覽器地區設定時,會提供最適化表單的本地化版本(如果可用)。 本地化最適化表單的語言是以為瀏覽器設定的地區(瀏覽器地區)為基礎。 這可能只會導致[快取適用性表單的第一個例項]。 若要防止問題在您的執行個體上發生,請參閱疑難排解。執行下列步驟,在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"
}
新增上述項目時:
最適化表單會保留在快取中,直到未發佈更新後的表單版本為止。
發佈最適化表單中參考的較新版本資源時,受影響的最適化表單會自動失效。 引用資源的自動失效有一些例外。 有關例外的解決方法,請參閱疑難解答部分。
新增下列rules 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沒有任何本地化資訊,且啟用設定管理器中的使用瀏覽器區域設定時,會提供適用性表單的本地化版本,且只會快取最適化表單的第一個例項,並傳送給每個後續使用者。
執行下列步驟以解決問題:
開啟「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>