1 /** 2 * $RCSfile: Cacheable.java,v $ 3 * $Revision: 1.2 $ 4 * $Date: 2004/10/21 07:28:12 $ 5 * 6 * Copyright (C) 2004 Jive Software. All rights reserved. 7 * 8 * This software is published under the terms of the GNU Public License (GPL), 9 * a copy of which is included in this distribution. 10 */ 11 12 package org.jivesoftware.util; 13 14 /** 15 * Interface that defines the necessary behavior for objects added to a Cache. 16 * Objects only need to know how big they are (in bytes). That size 17 * should be considered to be a best estimate of how much memory the Object 18 * occupies and may be based on empirical trials or dynamic calculations.<p> 19 * 20 * While the accuracy of the size calculation is important, care should be 21 * taken to minimize the computation time so that cache operations are 22 * speedy. 23 * 24 * @author Jive Software 25 * @see org.jivesoftware.util.Cache 26 */ 27 public interface Cacheable extends java.io.Serializable { 28 29 /** 30 * Returns the approximate size of the Object in bytes. The size should be 31 * considered to be a best estimate of how much memory the Object occupies 32 * and may be based on empirical trials or dynamic calculations.<p> 33 * 34 * @return the size of the Object in bytes. 35 */ 36 public int getCachedSize(); 37 } 38