This is an automated email from the ASF dual-hosted git repository. adelbene pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git
commit 35e5d0a608f55f8f1b0efa87986438580cfea4c0 Author: Andrea Del Bene <[email protected]> AuthorDate: Fri Apr 30 22:35:01 2021 +0200 WICKET-6883 updated chapter 8 to reflect page storing changes --- .../src/main/asciidoc/img/wicket-cache.png | Bin 38486 -> 16844 bytes .../versioningCaching/versioningCaching_2.adoc | 21 +++++++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/wicket-user-guide/src/main/asciidoc/img/wicket-cache.png b/wicket-user-guide/src/main/asciidoc/img/wicket-cache.png index 0a96e12..e7adbf8 100644 Binary files a/wicket-user-guide/src/main/asciidoc/img/wicket-cache.png and b/wicket-user-guide/src/main/asciidoc/img/wicket-cache.png differ diff --git a/wicket-user-guide/src/main/asciidoc/versioningCaching/versioningCaching_2.adoc b/wicket-user-guide/src/main/asciidoc/versioningCaching/versioningCaching_2.adoc index 16d5fd1..67d35d1 100644 --- a/wicket-user-guide/src/main/asciidoc/versioningCaching/versioningCaching_2.adoc +++ b/wicket-user-guide/src/main/asciidoc/versioningCaching/versioningCaching_2.adoc @@ -89,15 +89,17 @@ A serializer based on Kryo library and another one based on Fast are provided by === Page caching -By default Wicket persists versions of pages into a session-relative file on disk, but it uses a two-level cache to speed up this process. The first level of the cache uses a http session attribute called “wicket:persistentPageManagerData-<APPLICATION_NAME>” to store pages. The second level cache stores pages into application-scoped variables which are identified by a session id and a page id. +By default Wicket persists versions of pages into a session-relative file on disk, but it uses a two-level cache to speed up the access. The first level of the cache contains all the pages involved in the current requests as we may visit more than one page during a single request, for example if we have been redirected with _setResponsePage_. +The second level cache stores the last rendered page into a session-scoped variables. + +NOTE: Scoped variables will be introduced in <<requestProcessing.adoc#_storing_arbitrary_objects_with_metadata,chapter 9.4.6>> which is about Wicket metadata. The following picture is an overview of these two caching levels: image::../img/wicket-cache.png[] -The session-scoped cache is faster then the other memory levels but it contains only the pages used to serve the last request. Wicket allows us to set the maximum amount of memory allowed for the application-scoped cache and for the page store file. Both parameters can be configured via setting class _org.apache.wicket.settings.StoreSettings_. - -This interface provides the _setMaxSizePerSession(Bytes bytes)_ method to set the size for page store file. The Bytes parameter is the maximum size allowed for this file: +Wicket allows us to set the maximum size of the file used to store pages with setting class _org.apache.wicket.settings.StoreSettings_. +This class provides the _setMaxSizePerSession(Bytes bytes)_ method to set the size of the file. The Bytes parameter is the maximum size allowed for this file: [source,java] ---- @@ -110,17 +112,8 @@ public void init() ---- Class _org.apache.wicket.util.lang.Bytes_ is an utility class provided by Wicket to express size in bytes (for further details refer to the JavaDoc). -For the second level cache we can use the _setInmemoryCacheSize(int inmemoryCacheSize)_ method. The integer parameter is the maximum number of page instances that will be saved into application-scoped cache: -[source,java] ----- -@Override -public void init() -{ - super.init(); - getStoreSettings().setInmemoryCacheSize(50); -} ----- +NOTE: more insights on internal page handling will be covered in <<internals.adoc,chapter 26>> === Page expiration
