001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021 022package org.biojava.utils.cache; 023 024/** 025 * <p> 026 * Interface for managing caches of objects fetchable by key. 027 * </p> 028 * 029 * <p> 030 * The map may chose to remove a mapping, for example to free memory, or if the 031 * data has become too old to be useful. 032 * </p> 033 * 034 * @author Matthew Pocock 035 * @since 1.1 036 */ 037 038public interface CacheMap { 039 /** 040 * Associate a value with a key. The association may be broken at any time. 041 * 042 * @param key the key Object 043 * @param value the Object to associate with the key 044 */ 045 public void put(Object key, Object value); 046 047 /** 048 * Retrieve the Object associated with the key, or null if either no value has 049 * been associated or if the key's value has been cleared by the cache. 050 * 051 * @param key the key Object 052 * @return the Object currently associated with the key 053 */ 054 public Object get(Object key); 055 056 /** 057 * Explicitly remove an object. 058 * 059 * @param value the item to remove 060 */ 061 public void remove(Object value); 062}