001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2004-2005 TONBELLER AG 008// Copyright (C) 2006-2012 Pentaho and others 009// All Rights Reserved. 010*/ 011package mondrian.rolap.cache; 012 013import java.util.*; 014 015/** 016 * An implementation of {@link SmartCache} that uses hard 017 * references. Used for testing. 018 */ 019public class HardSmartCache <K, V> extends SmartCacheImpl<K, V> { 020 Map<K, V> cache = new HashMap<K, V>(); 021 022 public V putImpl(K key, V value) { 023 return cache.put(key, value); 024 } 025 026 public V getImpl(K key) { 027 return cache.get(key); 028 } 029 030 public V removeImpl(K key) { 031 return cache.remove(key); 032 } 033 034 public void clearImpl() { 035 cache.clear(); 036 } 037 038 public int sizeImpl() { 039 return cache.size(); 040 } 041 042 public Iterator<Map.Entry<K, V>> iteratorImpl() { 043 return cache.entrySet().iterator(); 044 } 045} 046 047// End HardSmartCache.java