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