org.apache.wss4j.common.cache
Class EHCacheReplayCache

java.lang.Object
  extended by org.apache.wss4j.common.cache.EHCacheReplayCache
All Implemented Interfaces:
Closeable, ReplayCache

public class EHCacheReplayCache
extends Object
implements ReplayCache

An in-memory EHCache implementation of the ReplayCache interface. The default TTL is 60 minutes and the max TTL is 12 hours.


Field Summary
protected  net.sf.ehcache.Ehcache cache
           
protected  net.sf.ehcache.CacheManager cacheManager
           
static long DEFAULT_TTL
           
static long MAX_TTL
           
protected  long ttl
           
 
Constructor Summary
EHCacheReplayCache(String key, net.sf.ehcache.CacheManager cacheManager)
           
EHCacheReplayCache(String key, URL configFileURL)
           
 
Method Summary
 void add(String identifier)
          Add the given identifier to the cache.
 void add(String identifier, long timeToLive)
          Add the given identifier to the cache to be cached for the given time
 void close()
           
 boolean contains(String identifier)
          Return true if the given identifier is contained in the cache
 long getTTL()
          Get the (default) TTL value in seconds
 void initComplete()
           
 void postShutdown()
           
 void preShutdown()
           
 void setTTL(long newTtl)
          Set a new (default) TTL value in seconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TTL

public static final long DEFAULT_TTL
See Also:
Constant Field Values

MAX_TTL

public static final long MAX_TTL
See Also:
Constant Field Values

cache

protected net.sf.ehcache.Ehcache cache

cacheManager

protected net.sf.ehcache.CacheManager cacheManager

ttl

protected long ttl
Constructor Detail

EHCacheReplayCache

public EHCacheReplayCache(String key,
                          URL configFileURL)

EHCacheReplayCache

public EHCacheReplayCache(String key,
                          net.sf.ehcache.CacheManager cacheManager)
Method Detail

setTTL

public void setTTL(long newTtl)
Set a new (default) TTL value in seconds

Parameters:
newTtl - a new (default) TTL value in seconds

getTTL

public long getTTL()
Get the (default) TTL value in seconds

Returns:
the (default) TTL value in seconds

add

public void add(String identifier)
Add the given identifier to the cache. It will be cached for a default amount of time.

Specified by:
add in interface ReplayCache
Parameters:
identifier - The identifier to be added

add

public void add(String identifier,
                long timeToLive)
Add the given identifier to the cache to be cached for the given time

Specified by:
add in interface ReplayCache
Parameters:
identifier - The identifier to be added
timeToLive - The length of time to cache the Identifier in seconds

contains

public boolean contains(String identifier)
Return true if the given identifier is contained in the cache

Specified by:
contains in interface ReplayCache
Parameters:
identifier - The identifier to check

close

public void close()
Specified by:
close in interface Closeable

initComplete

public void initComplete()

preShutdown

public void preShutdown()

postShutdown

public void postShutdown()


Copyright © 2004–2015 The Apache Software Foundation. All rights reserved.