org.mule.cache
Class ObjectStoreCachingStrategy

java.lang.Object
  extended by org.mule.cache.ObjectStoreCachingStrategy
All Implemented Interfaces:
CachingStrategy

public class ObjectStoreCachingStrategy
extends Object
implements CachingStrategy

Implements CachingStrategy using an ObjectStore as a cache.

Object's keys are generated using a KeyGenerator and the responses are generated using a ResponseGenerator. The caching strategy will only cache the MuleEvent that have a non consumable message's payload. This check is done in both request and response events using a configurable Filter.


Field Summary
protected  Log logger
           
 
Constructor Summary
ObjectStoreCachingStrategy()
           
 
Method Summary
 Filter getConsumableFilter()
           
 KeyGenerator getKeyGenerator()
           
 String getName()
           
 ResponseGenerator getResponseGenerator()
           
 ObjectStore<MuleEvent> getStore()
           
 MuleEvent process(MuleEvent request, MessageProcessor messageProcessor)
          Processes a MuleEvent using a caching schema.
protected  MuleEvent retrieve(Serializable key)
           
 void setConsumableFilter(Filter consumableFilter)
           
 void setKeyGenerator(KeyGenerator keyGenerator)
           
 void setName(String name)
           
 void setResponseGenerator(ResponseGenerator responseGenerator)
           
 void setStore(ObjectStore<MuleEvent> store)
           
protected  void store(Serializable key, MuleEvent value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Log logger
Constructor Detail

ObjectStoreCachingStrategy

public ObjectStoreCachingStrategy()
Method Detail

process

public MuleEvent process(MuleEvent request,
                         MessageProcessor messageProcessor)
                  throws MuleException
Description copied from interface: CachingStrategy
Processes a MuleEvent using a caching schema. Uses a message processor to process the request when it is not found in the cache or when it must be processed without using the cache.

Different calls to this method using the same request does not implies that the same instance will be returned. Each implementation could choose to create new instances every time.

Specified by:
process in interface CachingStrategy
Parameters:
request - the event to process
messageProcessor - the message processor that will be executed when the response for the event is not in the cache.
Returns:
a response for the request that could be obtained using the cache.
Throws:
MuleException

store

protected void store(Serializable key,
                     MuleEvent value)

retrieve

protected MuleEvent retrieve(Serializable key)

getStore

public ObjectStore<MuleEvent> getStore()

setStore

public void setStore(ObjectStore<MuleEvent> store)

getKeyGenerator

public KeyGenerator getKeyGenerator()

setKeyGenerator

public void setKeyGenerator(KeyGenerator keyGenerator)

getResponseGenerator

public ResponseGenerator getResponseGenerator()

setResponseGenerator

public void setResponseGenerator(ResponseGenerator responseGenerator)

getConsumableFilter

public Filter getConsumableFilter()

setConsumableFilter

public void setConsumableFilter(Filter consumableFilter)

getName

public String getName()

setName

public void setName(String name)


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.