001    /*
002    // This software is subject to the terms of the Common Public License
003    // Agreement, available at the following URL:
004    // http://www.opensource.org/licenses/cpl.html.
005    // Copyright (C) 2004-2005 TONBELLER AG
006    // All Rights Reserved.
007    // You must accept the terms of that agreement to use this software.
008    */
009    package mondrian.rolap.cache;
010    
011    import java.util.Map;
012    
013    /**
014     * Defines a cache API. Implementations exist for hard and soft references.
015     *
016     * <p>This interface implements the {@link Iterable}. The {@link #iterator()}
017     * method returns an iterator over all entries in the cache. The iterator
018     * is mutable.
019     *
020     * @author av
021     * @since Nov 21, 2005
022     * @version $Id: //open/mondrian/src/main/mondrian/rolap/cache/SmartCache.java#6 $
023     */
024    public interface SmartCache <K, V> extends Iterable<Map.Entry<K, V>> {
025        /**
026         * Places a key/value pair into the queue.
027         *
028         * @param key Key
029         * @param value Value
030         * @return the previous value of <code>key</code> or null
031         */
032        V put(K key, V value);
033    
034        V get(K key);
035    
036        void clear();
037    
038        int size();
039    }
040    
041    // End SmartCache.java