parent
650db59e69
commit
008912fd5e
|
@ -17,6 +17,12 @@
|
|||
<Ref id="idMgr"/>
|
||||
</Set>
|
||||
<Set name="scavengeIntervalSec">600</Set>
|
||||
<!-- uncomment and configure the secs before a memcache entry is evicted
|
||||
<Set name="expirySec">86400</Set>
|
||||
-->
|
||||
<!-- uncomment and configure whether memcached does heartbeats or not
|
||||
<Set name="heartbeats">false</Set>
|
||||
-->
|
||||
<Set name="host"><Env name="MEMCACHE_PORT_11211_TCP_ADDR" default="localhost"/></Set>
|
||||
<Set name="port"><Env name="MEMCACHE_PORT_11211_TCP_PORT" default="11211"/></Set>
|
||||
</New>
|
||||
|
|
|
@ -52,6 +52,7 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
protected String _port;
|
||||
protected MemcachedClient _client;
|
||||
protected int _expirySec = 0;
|
||||
private boolean _heartbeats = true;
|
||||
|
||||
|
||||
|
||||
|
@ -212,6 +213,15 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param heartbeats if true memcached heartbeats are enabled. Default is true.
|
||||
*/
|
||||
public void setHeartbeats (boolean heartbeats)
|
||||
{
|
||||
_heartbeats = heartbeats;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doStart() throws Exception
|
||||
{
|
||||
|
@ -222,6 +232,8 @@ public class GCloudMemcachedSessionManager extends GCloudSessionManager
|
|||
|
||||
XMemcachedClientBuilder builder = new XMemcachedClientBuilder(_host+":"+_port);
|
||||
_client = builder.build();
|
||||
_client.setEnableHeartBeat(_heartbeats);
|
||||
|
||||
|
||||
_client.setTranscoder(new ContextClassloaderSerializingTranscoder());
|
||||
super.doStart();
|
||||
|
|
Loading…
Reference in New Issue