Add module for session data cache
This commit is contained in:
parent
64e8d1ff5d
commit
d52a1701ad
|
@ -793,5 +793,10 @@
|
|||
<artifactId>jetty-nosql</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.memcached</groupId>
|
||||
<artifactId>jetty-memcached-sessions</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.gcloud.session.GCloudSessionDataStoreFactory">
|
||||
<New id="sessionDataStoreFactory" class="org.eclipse.jetty.gcloud.session.GCloudSessionDataStoreFactory">
|
||||
<Set name="gCloudConfiguration"><Ref id="gconf"/></Set>
|
||||
<Set name="gracePeriodSec"><Property name="jetty.session.gracePeriod.seconds" default="3600" /></Set>
|
||||
<Set name="maxRetries"><Property name="jetty.gcloudSession.maxRetries" default="5"/></Set>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.session.InfinispanSessionStoreFactory">
|
||||
<New id="sessionDataStoreFactory" class="org.eclipse.jetty.server.session.InfinispanSessionStoreFactory">
|
||||
<Set name="cache"><Ref id="cache"/></Set>
|
||||
<Set name="infinispanIdleTimeoutSec"><Property name="jetty.session.infinispanIdleTimeout.seconds" default="0" /></Set>
|
||||
<Set name="gracePeriod"><Property name="jetty.session.gracePeriod.seconds" default="3600" /></Set>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.session.InfinispanSessionStoreFactory">
|
||||
<New id="sessionDataStoreFactory" class="org.eclipse.jetty.server.session.InfinispanSessionStoreFactory">
|
||||
<Set name="cache"><Ref id="remoteCache"/></Set>
|
||||
<Set name="infinispanIdleTimeoutSec"><Property name="jetty.session.infinispanIdleTimeout.seconds" default="0" /></Set>
|
||||
<Set name="gracePeriod"><Property name="jetty.session.gracePeriod.seconds" default="3600" /></Set>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
<New id="sessionDataMapFactory" class="org.eclipse.jetty.memcached.session.MemcachedSessionDataMapFactory">
|
||||
<Set name="host"><Property name="jetty.session.memcache.host" default="localhost"/></Set>
|
||||
<Set name="port"><Property name="jetty.session.memcache.port" default="11211"/></Set>
|
||||
<Set name="expirySec"><Property name="etty.session.memcache.expirySec" default="0"/></Set>
|
||||
</New>
|
||||
</Configure>
|
|
@ -0,0 +1,22 @@
|
|||
[description]
|
||||
Memcache cache for SessionData
|
||||
|
||||
[depends]
|
||||
session-store
|
||||
|
||||
[files]
|
||||
maven://com.googlecode.xmemcached/xmemcached/2.0.0|lib/xmemcached/xmemcached-2.0.0.jar
|
||||
maven://org.slf4j/slf4j-api/1.6.6|lib/xmemcached/slf4j-api-1.6.6.jar
|
||||
|
||||
[lib]
|
||||
lib/jetty-memcached-sessions-${jetty.version}.jar
|
||||
lib/xmemcached
|
||||
|
||||
[license]
|
||||
Xmemcached is an open source project hosted on Github and released under the Apache 2.0 license.
|
||||
https://github.com/killme2008/xmemcached
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
|
||||
[xml]
|
||||
etc/sessions/session-data-cache/xmemcached.xml
|
|
@ -60,13 +60,13 @@ public class MemcachedSessionDataMapFactory implements SessionDataMapFactory
|
|||
|
||||
|
||||
|
||||
public int getExpiry()
|
||||
public int getExpirySec()
|
||||
{
|
||||
return _expiry;
|
||||
}
|
||||
|
||||
|
||||
public void setExpiry(int expiry)
|
||||
public void setExpirySec(int expiry)
|
||||
{
|
||||
_expiry = expiry;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.session.MongoSessionStoreFactory">
|
||||
<New id="sessionDataStoreFactory" class="org.eclipse.jetty.server.session.MongoSessionStoreFactory">
|
||||
<Set name="dbName"><Property name="jetty.session.dbName" default="HttpSessions" /></Set>
|
||||
<Set name="collectionName"><Property name="jetty.session.collectionName" default="jettySessions" /></Set>
|
||||
<Set name="gracePeriod"><Property name="jetty.session.gracePeriod.seconds" default="3600" /></Set>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.session.FileSessionDataStoreFactory">
|
||||
<New id="sessionDataStoreFactory" class="org.eclipse.jetty.server.session.FileSessionDataStoreFactory">
|
||||
<Set name="deleteUnrestorableFiles"><Property name="jetty.session.deleteUnrestorableFiles" default="false" /></Set>
|
||||
<Set name="storeDir"><Property name="jetty.session.storeDir"/></Set>
|
||||
</New>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.session.JDBCSessionDataStoreFactory">
|
||||
<New id="sessionDataStoreFactory" class="org.eclipse.jetty.server.session.JDBCSessionDataStoreFactory">
|
||||
<Set name="gracePeriodSec"><Property name="jetty.session.gracePeriod.seconds" default="3600" /></Set>
|
||||
<Set name="databaseAdaptor">
|
||||
<Ref id="databaseAdaptor"/>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Configure a factory for CachingSessionDataStores -->
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<Call name="removeBean">
|
||||
<Ref id="sessionDataStoreFactory"/>
|
||||
</Call>
|
||||
|
||||
|
||||
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.session.CachingSessionDataStoreFactory">
|
||||
<Set name="sessionStoreFactory"><Ref id="sessionDataStoreFactory"/></Set>
|
||||
<Set name="sessionDataMapFactory"><Ref id="sessionDataMapFatory"/></Set>
|
||||
</New>
|
||||
</Arg>
|
||||
|
||||
</Configure>
|
|
@ -0,0 +1,24 @@
|
|||
[description]
|
||||
Enables caching of SessionData in front of a SessionDataStore.
|
||||
|
||||
|
||||
[depend]
|
||||
session-store
|
||||
sessions/session-data-cache/${session-data-cache}
|
||||
|
||||
|
||||
[xml]
|
||||
etc/sessions/session-data-cache/session-caching-store.xml
|
||||
|
||||
|
||||
[ini]
|
||||
session-data-cache=xmemcached
|
||||
|
||||
[ini-template]
|
||||
|
||||
## Session Data Cache type: xmemcached
|
||||
session-data-cache=xmemcached
|
||||
#jetty.session.memcached.host=localhost
|
||||
#jetty.session.memcached.port=11211
|
||||
#jetty.session.memcached.expirySec=
|
||||
|
Loading…
Reference in New Issue