1 /* 2 * $Id: CachingStrategy.java 22607 2011-08-08 02:13:54Z pablo.kraan $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.cache; 12 13 import org.mule.api.MuleEvent; 14 import org.mule.api.MuleException; 15 import org.mule.api.processor.MessageProcessor; 16 17 /** 18 * Defines a way to process a {@link MuleEvent} using a cache. 19 */ 20 public interface CachingStrategy 21 { 22 23 /** 24 * Processes a {@link MuleEvent} using a caching schema. Uses a message processor 25 * to process the request when it is not found in the cache or when it must 26 * be processed without using the cache. 27 * <p/> 28 * Different calls to this method using the same request does not implies 29 * that the same instance will be returned. Each implementation could 30 * choose to create new instances every time. 31 * 32 * @param request the event to process 33 * @param messageProcessor the message processor that will be executed when 34 * the response for the event is not in the cache. 35 * @return a response for the request that could be obtained using the 36 * cache. 37 * @throws MuleException 38 */ 39 MuleEvent process(MuleEvent request, MessageProcessor messageProcessor) throws MuleException; 40 }