2022-01-17 13:31:34 +00:00
|
|
|
[[offline-sessions-preloading]]
|
|
|
|
|
2021-06-17 14:39:30 +00:00
|
|
|
=== Offline sessions preloading
|
2021-05-31 18:05:04 +00:00
|
|
|
|
2024-01-10 15:44:56 +00:00
|
|
|
In addition to Infinispan caches, offline sessions are stored in a database which means they will be available even after server restart.
|
|
|
|
By default, the offline sessions are not preloaded from the database into the Infinispan caches during the server startup, because this
|
2022-01-17 13:31:34 +00:00
|
|
|
approach has a drawback if there are many offline sessions to be preloaded. It can significantly slow down the server startup time.
|
|
|
|
Therefore, the offline sessions are lazily fetched from the database by default.
|
2021-05-31 18:05:04 +00:00
|
|
|
|
2024-01-10 15:44:56 +00:00
|
|
|
However, {project_name} can be configured to preload the offline sessions from the database into the Infinispan caches during the server startup.
|
2022-01-17 13:31:34 +00:00
|
|
|
It can be achieved by setting `preloadOfflineSessionsFromDatabase` property in the `userSessions` SPI to `true`.
|
2021-05-31 18:05:04 +00:00
|
|
|
|
2022-01-17 13:31:34 +00:00
|
|
|
The following example shows how to configure offline sessions preloading.
|
2021-05-31 18:05:04 +00:00
|
|
|
|
2022-02-08 13:07:16 +00:00
|
|
|
[source,bash]
|
|
|
|
----
|
2022-08-02 12:11:52 +00:00
|
|
|
bin/kc.[sh|bat] start --spi-user-sessions-infinispan-preload-offline-sessions-from-database=true
|
2022-02-08 13:07:16 +00:00
|
|
|
----
|