Version: 9.4.27.v20200227 |

Persistent Sessions: The L2 Session Data Cache
Previous | Chapter 10. Session Management Home | Next

##### 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

## Persistent Sessions: The L2 Session Data Cache

If your chosen persistence technology is slow, it can be helpful to locally cache the session data. The `CachingSessionDataStore` is a special type of `SessionDataStore` that locally caches session data, which makes reads faster. It writes-through to your chosen type of `SessionDataStore` when session data changes.

### MemcachedSessionDataMap

The `MemcachedSessionDataMap` uses `memcached` to perform caching.

To enable it with the Jetty distribution, enable the `session-store-cache` module, along with your chosen `session-store-xxxx` module, and optionally the `session-cache-hash` or `session-cache-null` modules.

After enabling, the `$jetty.base/start.d/session-store-cache.ini` file will be generated:

    --module=session-store-cache

    ## Session Data Cache type: xmemcached
    session-data-cache=xmemcached
    #jetty.session.memcached.host=localhost
    #jetty.session.memcached.port=11211
    #jetty.session.memcached.expirySec=
    #jetty.session.memcached.heartbeats=true

The configuration properties are:

jetty.session.memcached.host
  Default value is `localhost`. This is the host on which the memcached server resides.
jetty.session.memcached.port
  Default value is `11211`. This is the port on which the memcached server is listening.
jetty.session.memcached.expirySec
  Default value `0`. This is the length of time in seconds that an item can remain in the memcached cache, where 0 indicates indefinitely.
jetty.session.memcached.heartbeats
  Default value `true`. Whether or not the memcached system should generate heartbeats.

Previous | Top | Next
Persistent Sessions: Google Cloud DataStore | Home | Session Use Cases

See an error or something missing? Contribute to this documentation at Github!(Generated: 2020-02-27)