001 /**
002 *
003 * Copyright 2004 Hiram Chirino
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 **/
018 package org.activemq.store.cache;
019
020 import org.activemq.message.ActiveMQMessage;
021
022 /**
023 * Defines the interface used to cache messages.
024 *
025 * @version $Revision: 1.1.1.1 $
026 */
027 public interface MessageCache {
028 /**
029 * Gets a message that was previously <code>put</code> into this object.
030 *
031 * @param msgid
032 * @return null if the message was not previously put or if the message has expired out of the cache.
033 */
034 public ActiveMQMessage get(String msgid);
035
036 /**
037 * Puts a message into the cache.
038 *
039 * @param messageID
040 * @param message
041 */
042 public void put(String messageID, ActiveMQMessage message);
043
044 /**
045 * Remvoes a message from the cache.
046 *
047 * @param messageID
048 */
049 public void remove(String messageID);
050
051 /**
052 * Lets a cache know it will not be used any further and that it can release
053 * aquired resources
054 */
055 public void close();
056
057 }