001: /*
002: * Copyright (c) JForum Team
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms,
006: * with or without modification, are permitted provided
007: * that the following conditions are met:
008: *
009: * 1) Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the
011: * following disclaimer.
012: * 2) Redistributions in binary form must reproduce the
013: * above copyright notice, this list of conditions and
014: * the following disclaimer in the documentation and/or
015: * other materials provided with the distribution.
016: * 3) Neither the name of "Rafael Steil" nor
017: * the names of its contributors may be used to endorse
018: * or promote products derived from this software without
019: * specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
022: * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
023: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
025: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
026: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
027: * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
028: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
029: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
031: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
032: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
033: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
034: * IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
036: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
037: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: *
039: * Created on Jan 13, 2005 5:58:36 PM
040: * The JForum Project
041: * http://www.jforum.net
042: */
043: package net.jforum.cache;
044:
045: import java.util.Collection;
046:
047: /**
048: * @author Rafael Steil
049: * @version $Id: CacheEngine.java,v 1.11 2006/08/20 22:47:56 rafaelsteil Exp $
050: */
051: public interface CacheEngine {
052: public static final String DUMMY_FQN = "";
053: public static final String NOTIFICATION = "notification";
054:
055: /**
056: * Inits the cache engine.
057: */
058: public void init();
059:
060: /**
061: * Stops the cache engine
062: */
063: public void stop();
064:
065: /**
066: * Adds a new object to the cache.
067: * The fqn will be set as the value of {@link #DUMMY_FQN}
068: *
069: * @param key The key to associate with the object.
070: * @param value The object to cache
071: */
072: public void add(String key, Object value);
073:
074: /**
075: *
076: * Adds a new object to the cache.
077: *
078: * @param fqn The fully qualified name of the cache.
079: * @param key The key to associate with the object
080: * @param value The object to cache
081: */
082: public void add(String fqn, String key, Object value);
083:
084: /**
085: * Gets some object from the cache.
086: *
087: * @param fqn The fully qualified name associated with the key
088: * @param key The key to get
089: * @return The cached object, or <code>null</code> if no entry was found
090: */
091: public Object get(String fqn, String key);
092:
093: /**
094: * Gets some object from the cache.
095: *
096: * @param fqn The fqn tree to get
097: * @return The cached object, or <code>null</code> if no entry was found
098: */
099: public Object get(String fqn);
100:
101: /**
102: * Gets all values from some given FQN.
103: *
104: * @param fqn String
105: * @return Collection
106: */
107: public Collection getValues(String fqn);
108:
109: /**
110: * Removes an entry from the cache.
111: *
112: * @param fqn The fully qualified name associated with the key
113: * @param key The key to remove
114: */
115: public void remove(String fqn, String key);
116:
117: /**
118: * Removes a complete note from the cache
119: * @param fqn The fqn to remove
120: */
121: public void remove(String fqn);
122: }
|