Cache.java |
/* Copyright (C) 2009 CSE,IIT Bombay http://www.cse.iitb.ac.in This file is part of the ConStore open source storage facility for concept-nets. ConStore is free software and distributed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License; you can copy, distribute and transmit the work with the work attribution in the manner specified by the author or licensor. You may not use this work for commercial purposes and may not alter, transform, or build upon this work. Please refer the legal code of the license, available at http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode ConStore is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ package iitb.con.caching; /** * Caching for Queries * * @author Prathab K * */ public interface Cache<K> { /** * Returns the cached object for the given key * @param key key used to retrieve the object * @return cached object if present, else returns <tt>NULL</tt> * @see CacheObject */ public CacheObject get(K key); /** * Places the cache object in the cache using the key * @param key key used to place the object * @param obj cache object * @return <tt>true</tt> on success * @see CacheObject */ public boolean put(K key, CacheObject obj); /** * Returns the size of cache in bytes * @return cache size as long */ public long getSize(); /** * Returns the available free space * @return cache free space */ public long freeSpace(); /** * Clears the cache */ public void clear(); }