public class CacheMediator
extends org.apache.synapse.mediators.AbstractMediator
implements org.apache.synapse.ManagedLifecycle, org.apache.synapse.debug.constructs.EnclosedInlinedSequence
Constructor and Description |
---|
CacheMediator(CacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
exposeInvalidator(org.apache.synapse.MessageContext msgCtx)
Exposes the whole mediator cache through jmx MBean.
|
DigestGenerator |
getDigestGenerator()
This method gives the DigestGenerator to evaluate the hash values of incoming messages.
|
String |
getHashGenerator()
This returns the hash generator used to evaluate the hash value.
|
String[] |
getHeadersToExcludeInHash()
This method gives array of headers that would be excluded when hashing.
|
String[] |
getHTTPMethodsToCache()
This method gives the HTTP method that needs to be cached.
|
String |
getId()
This method returns the id of the cache configuration.
|
String |
getImplementationType()
This method returns the cache implementation type.
|
org.apache.synapse.Mediator |
getInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg,
int inlinedSeqIdentifier) |
int |
getInMemoryCacheSize()
This method gives the size of the messages to be cached in memory.
|
int |
getMaxMessageSize()
This method gives the maximum size of the messages to be cached in bytes.
|
com.google.common.cache.LoadingCache<String,CachableResponse> |
getMediatorCache()
Creates default cache to keep mediator cache.
|
String |
getOnCacheHitRef()
This method gives reference to the onCacheHit sequence to be executed.
|
org.apache.synapse.mediators.base.SequenceMediator |
getOnCacheHitSequence()
This method gives SequenceMediator to be executed.
|
String |
getProtocolType() |
String |
getResponseCodes() |
String |
getScope()
This method returns the scope of the cache.
|
long |
getTimeout()
This method gives the timeout period in milliseconds.
|
void |
init(org.apache.synapse.core.SynapseEnvironment se) |
boolean |
isAddAgeHeaderEnabled()
This method returns whether an Age header needs to be included or not.
|
boolean |
isCacheControlEnabled()
This method returns whether cache-control is enabled or not.
|
boolean |
isCollector()
This method gives whether the mediator should be in the incoming path or in the outgoing path as a boolean.
|
boolean |
isPreviousCacheImplementation()
This method returns whether this represents the previous cache implementation or not.
|
boolean |
mediate(org.apache.synapse.MessageContext synCtx) |
void |
setAddAgeHeaderEnabled(boolean addAgeHeaderEnabled)
This method sets whether an Age header needs to be included or not.
|
void |
setCacheControlEnabled(boolean cacheControlEnabled)
This method sets whether cache-control is enabled or not.
|
void |
setCollector(boolean collector)
This method sets whether the mediator should be in the incoming path or in the outgoing path as a boolean.
|
void |
setDigestGenerator(DigestGenerator digestGenerator)
This method sets the DigestGenerator to evaluate the hash values of incoming messages.
|
void |
setHashGenerator(String hashGenerator)
This method sets the hash generator class.
|
void |
setHeadersToExcludeInHash(String... headersToExcludeInHash)
This method sets the array of headers that would be excluded when hashing.
|
void |
setHTTPMethodsToCache(String... hTTPMethodToCache)
This sets the HTTP method that needs to be cached.
|
void |
setId(String id)
This method sets the id of the cache configuration.
|
void |
setImplementationType(String implementationType)
This method sets the cache implementation type.
|
void |
setInMemoryCacheSize(int inMemoryCacheSize)
This method sets the size of the messages to be cached in memory.
|
void |
setMaxMessageSize(int maxMessageSize)
This method sets the maximum size of the messages to be cached in bytes.
|
void |
setOnCacheHitRef(String onCacheHitRef)
This method sets reference to the onCacheHit sequence to be executed.
|
void |
setOnCacheHitSequence(org.apache.synapse.mediators.base.SequenceMediator onCacheHitSequence)
This method sets SequenceMediator to be executed.
|
void |
setPreviousCacheImplementation(boolean previousCacheImplementation)
This method sets whether this represents the previous cache implementation or not.
|
void |
setProtocolType(String protocolType)
This method sets protocolType of the messages.
|
void |
setResponseCodes(String responseCodes)
This method sets the response codes that needs to be cached.
|
void |
setScope(String scope)
This method sets the scope of the cache.
|
void |
setTimeout(long timeout)
This method sets the timeout period as milliseconds.
|
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorName, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, getType, handleException, handleException, isBreakPoint, isContentAltering, isContentAware, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, reportOpenStatistics, setBreakPoint, setCommentsList, setComponentStatisticsId, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
public CacheMediator(CacheManager cacheManager)
public void init(org.apache.synapse.core.SynapseEnvironment se)
init
in interface org.apache.synapse.ManagedLifecycle
public void destroy()
destroy
in interface org.apache.synapse.ManagedLifecycle
public boolean mediate(org.apache.synapse.MessageContext synCtx)
mediate
in interface org.apache.synapse.Mediator
public com.google.common.cache.LoadingCache<String,CachableResponse> getMediatorCache()
public org.apache.synapse.Mediator getInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg, int inlinedSeqIdentifier)
getInlineSequence
in interface org.apache.synapse.debug.constructs.EnclosedInlinedSequence
public void exposeInvalidator(org.apache.synapse.MessageContext msgCtx)
public DigestGenerator getDigestGenerator()
public void setDigestGenerator(DigestGenerator digestGenerator)
digestGenerator
- DigestGenerator to be set to evaluate hash values.public long getTimeout()
public void setTimeout(long timeout)
timeout
- millisecond timeout period to be set.public boolean isCollector()
public void setCollector(boolean collector)
collector
- boolean value to be set as collector.public String[] getHeadersToExcludeInHash()
public void setHeadersToExcludeInHash(String... headersToExcludeInHash)
headersToExcludeInHash
- array of headers to exclude from hashing.public org.apache.synapse.mediators.base.SequenceMediator getOnCacheHitSequence()
public void setOnCacheHitSequence(org.apache.synapse.mediators.base.SequenceMediator onCacheHitSequence)
onCacheHitSequence
- sequence mediator to be set.public String getOnCacheHitRef()
public void setOnCacheHitRef(String onCacheHitRef)
onCacheHitRef
- reference to the onCacheHit sequence to be set.public int getInMemoryCacheSize()
public void setInMemoryCacheSize(int inMemoryCacheSize)
inMemoryCacheSize
- value(number of bytes) to be set as memory cache size.public String[] getHTTPMethodsToCache()
public void setHTTPMethodsToCache(String... hTTPMethodToCache)
hTTPMethodToCache
- the HTTP method to be cachedpublic String getProtocolType()
public void setProtocolType(String protocolType)
protocolType
- protocol type of the messages.public String getResponseCodes()
public void setResponseCodes(String responseCodes)
responseCodes
- the response codes to be cached in regex form.public int getMaxMessageSize()
public void setMaxMessageSize(int maxMessageSize)
maxMessageSize
- maximum size of the messages to be set in bytes.public boolean isCacheControlEnabled()
public void setCacheControlEnabled(boolean cacheControlEnabled)
cacheControlEnabled
- whether cache-control is enabled or not.public boolean isAddAgeHeaderEnabled()
public void setAddAgeHeaderEnabled(boolean addAgeHeaderEnabled)
addAgeHeaderEnabled
- whether an Age header needs to be included or not.public void setId(String id)
id
- id of the cache configurationpublic String getId()
public void setHashGenerator(String hashGenerator)
hashGenerator
- hash generator used to evaluate the hash valuepublic String getHashGenerator()
public void setScope(String scope)
scope
- scope of the cachepublic String getScope()
public void setImplementationType(String implementationType)
implementationType
- cache implementation typepublic String getImplementationType()
public boolean isPreviousCacheImplementation()
public void setPreviousCacheImplementation(boolean previousCacheImplementation)
previousCacheImplementation
- whether this represents the previous cache implementation or notCopyright © 2019 WSO2. All rights reserved.