I think you need the maxIdleBackup setting. From the linked javadoc:
Sets the option to back sessions up to the Store after they are used
in a request. Sessions remain available in memory after being backed
up, so they are not passivated as they are when swapped out. The value
set indicates how old a session may get (since its last use) before it
must be backed up: -1
means sessions are not backed up.
Note that this is not a hard limit: sessions are checked against this
age limit periodically according to processExpiresFrequency
. This
value should be considered to indicate when a session is ripe for
backing up.
So it is possible that a session may be idle for maxIdleBackup
+
processExpiresFrequency
* engine.backgroundProcessorDelay
seconds,
plus the time it takes to handle other session expiration, swapping,
etc. tasks.