Jetty Logo
Version: 9.4.7.v20170914
Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

The L1 Session Cache

The DefaultSessionCache
The NullSessionCache

The DefaultSessionCache

In the absence of any explicit configuration, Jetty will instantiate an instance of the DefaultSessionCache per context. If you wish to change any of the default values, you need to enable the session-cache-hash module.

Once the session-cache-hash module has been enabled, you can view a list of all the configurable values by opening start.d/session-cache-hash.ini:

--module=session-cache-hash

#jetty.session.evictionPolicy=-1
#jetty.session.saveOnInactiveEvict=false
#jetty.session.saveOnCreate=false
#jetty.session.removeUnloadableSessions=false
jetty.session.evictionPolicy

Integer. Controls whether session objects that are held in memory are subject to eviction from the memory cache. Evicting sessions can reduce the memory footprint of the cache. Eviction is usually used in conjunction with a SessionDataStore that persists sessions. Values are:

  • -1 : sessions are never evicted from the cache
  • 0 : sessions are evicted from the cache as soon as the last active request for it finishes
  • >= 1 : any positive number is the time in seconds after which a session that is in the cache but has not experienced any activity will be evicted

Note

If you are not using a SessionDataStore that persists sessions, be aware that evicted sessions will be lost.

jetty.session.saveOnInactiveEvict
Boolean, default false. Controls whether a session will be saved to the SessionDataStore just prior to its eviction.
jetty.session.saveOnCreate
Boolean, default false. Controls whether a session that is newly created will be immediately saved to the SessionDataStore or lazily saved as the last request for the session exits.
jetty.session.removeUnloadableSessions
Boolean, default false. Controls whether a session that cannot be restored - for example because it is corrupted - from the SessionDataStore is deleted by the SessionDataStore.

For more general information on the uses of these configuration properties, see Session Components.

The NullSessionCache

The NullSessionCache is a trivial implementation of the SessionCache that does not cache any session information. You may need to use it if your clustering setup does not have a sticky load balancer, or if you want absolutely minimal support for sessions. If you use this in conjunction with the NullSessionDataStore, then sessions will neither be retained in memory nor persisted.

To enable the NullSessionCache, enable the sesssion-cache-null module.

See an error or something missing? Contribute to this documentation at Github!(Generated: 2017-09-14)