001 /*--------------------------------------------------------------------------+
002 $Id: LRUStraightCacheBase.java 26268 2010-02-18 10:44:30Z juergens $
003 | |
004 | Copyright 2005-2010 Technische Universitaet Muenchen |
005 | |
006 | Licensed under the Apache License, Version 2.0 (the "License"); |
007 | you may not use this file except in compliance with the License. |
008 | You may obtain a copy of the License at |
009 | |
010 | http://www.apache.org/licenses/LICENSE-2.0 |
011 | |
012 | Unless required by applicable law or agreed to in writing, software |
013 | distributed under the License is distributed on an "AS IS" BASIS, |
014 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
015 | See the License for the specific language governing permissions and |
016 | limitations under the License. |
017 +--------------------------------------------------------------------------*/
018 package edu.tum.cs.commons.cache;
019
020 import edu.tum.cs.commons.error.NeverThrownRuntimeException;
021
022 /**
023 * This a special base class for last recently used (LRU) caches that work with
024 * identifiers that are suitable as hash keys.
025 *
026 * @author Florian Deissenboeck
027 * @author $Author: juergens $
028 *
029 * @version $Rev: 26268 $
030 * @levd.rating GREEN Hash: BDFF6A27A0F84128189790591C459DE8
031 *
032 * @param <I>
033 * the index type of the cache
034 * @param <E>
035 * the type stored in the cache
036 * @param <X>
037 * the type of exception thrown by the {@link #obtainItem(Object)}
038 * method. Use the {@link NeverThrownRuntimeException} if no
039 * exception will be thrown.
040 */
041 public abstract class LRUStraightCacheBase<I, E, X extends Exception> extends
042 LRUCacheBase<I, I, E, X> {
043
044 /** Constructor. */
045 public LRUStraightCacheBase(int maxSize) {
046 super(maxSize);
047 }
048
049 /**
050 * This method simply returns the identifier.
051 */
052 @Override
053 protected I getHashKey(I identifier) {
054 return identifier;
055 }
056
057 }