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