org.apache.synapse.mediators.builtin
Class CacheMediator

java.lang.Object
  extended by org.apache.synapse.mediators.AbstractMediator
      extended by org.apache.synapse.mediators.builtin.CacheMediator
All Implemented Interfaces:
AspectConfigurable, ManagedLifecycle, Mediator, SynapseArtifact

public class CacheMediator
extends AbstractMediator
implements ManagedLifecycle

CacheMediator will cache the response messages indexed using the hash value of the request message, and subsequent messages with the same request (request hash will be generated and checked for the equality) within the cache expiration period will be served from the stored responses in the cache

See Also:
Mediator

Field Summary
 
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
 
Constructor Summary
CacheMediator()
           
 
Method Summary
 void destroy()
          This method should implement the destroying of the implemented parts of the configuration.
 org.wso2.caching.digest.DigestGenerator getDigestGenerator()
           
 int getDiskCacheSize()
           
 String getId()
           
 int getInMemoryCacheSize()
           
 int getMaxMessageSize()
           
 String getOnCacheHitRef()
           
 SequenceMediator getOnCacheHitSequence()
           
 String getScope()
           
 long getTimeout()
           
 void init(SynapseEnvironment se)
          This method should implement the initialization of the implemented parts of the configuration.
 boolean isCollector()
           
 boolean mediate(MessageContext synCtx)
          Invokes the mediator passing the current message for mediation.
 void setCollector(boolean collector)
           
 void setDigestGenerator(org.wso2.caching.digest.DigestGenerator digestGenerator)
           
 void setDiskCacheSize(int diskCacheSize)
           
 void setId(String id)
           
 void setInMemoryCacheSize(int inMemoryCacheSize)
           
 void setMaxMessageSize(int maxMessageSize)
           
 void setOnCacheHitRef(String onCacheHitRef)
           
 void setOnCacheHitSequence(SequenceMediator onCacheHitSequence)
           
 void setScope(String scope)
           
 void setTimeout(long timeout)
           
 
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheMediator

public CacheMediator()
Method Detail

init

public void init(SynapseEnvironment se)
Description copied from interface: ManagedLifecycle
This method should implement the initialization of the implemented parts of the configuration.

Specified by:
init in interface ManagedLifecycle
Parameters:
se - SynapseEnvironment to be used for initialization

destroy

public void destroy()
Description copied from interface: ManagedLifecycle
This method should implement the destroying of the implemented parts of the configuration.

Specified by:
destroy in interface ManagedLifecycle

mediate

public boolean mediate(MessageContext synCtx)
Description copied from interface: Mediator
Invokes the mediator passing the current message for mediation. Each mediator performs its mediation action, and returns true if mediation should continue, or false if further mediation should be aborted.

Specified by:
mediate in interface Mediator
Parameters:
synCtx - the current message for mediation
Returns:
true if further mediation should continue

getId

public String getId()

setId

public void setId(String id)

getScope

public String getScope()

setScope

public void setScope(String scope)

isCollector

public boolean isCollector()

setCollector

public void setCollector(boolean collector)

getDigestGenerator

public org.wso2.caching.digest.DigestGenerator getDigestGenerator()

setDigestGenerator

public void setDigestGenerator(org.wso2.caching.digest.DigestGenerator digestGenerator)

getInMemoryCacheSize

public int getInMemoryCacheSize()

setInMemoryCacheSize

public void setInMemoryCacheSize(int inMemoryCacheSize)

getDiskCacheSize

public int getDiskCacheSize()

setDiskCacheSize

public void setDiskCacheSize(int diskCacheSize)

getTimeout

public long getTimeout()

setTimeout

public void setTimeout(long timeout)

getOnCacheHitSequence

public SequenceMediator getOnCacheHitSequence()

setOnCacheHitSequence

public void setOnCacheHitSequence(SequenceMediator onCacheHitSequence)

getOnCacheHitRef

public String getOnCacheHitRef()

setOnCacheHitRef

public void setOnCacheHitRef(String onCacheHitRef)

getMaxMessageSize

public int getMaxMessageSize()

setMaxMessageSize

public void setMaxMessageSize(int maxMessageSize)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.