01: /*
02: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: *
04: * All rights reserved.
05: *
06: * See end of file.
07: */
08:
09: package com.hp.hpl.jena.util.cache;
10:
11: /** An interface for controlling the behaviour of a cache.
12: *
13: * <p>This is separated from the main {@link Cache } interface
14: * so that methods return an object that can set control
15: * parameters on a cache, without granting read/write access
16: * to the cache itself.</p>
17: *
18: * <p>Cache's may be enabled or disabled. A disabled cache
19: * is a silent cache; it will silently not return objects
20: * from its store and not update its store. It will operate
21: * as if the cache always missed.</p>
22: *
23: * <p>Cache's keep statistics on their accesses. On a long
24: * running cache the numbers may exceeed the size of the
25: * variables counting the statistics, in which case, the
26: * fields counting gets hits and puts are reduced
27: * proportionately.</p>
28: *
29: * @author bwm
30: * @version $Version$
31: */
32: public interface CacheControl {
33:
34: /** Get the enabled state of the cache
35: * @return The enabled state of the cache
36: */
37: public boolean getEnabled();
38:
39: /** Set the enabled state of a cache
40: * @param enabled the new enabled state of the cache
41: * @return the previous enabled state of the cache
42: */
43: public boolean setEnabled(boolean enabled);
44:
45: /** Clear the cache's store
46: */
47: public void clear();
48:
49: /** Return number of gets on this cache.
50: *
51: *
52: * @return The number of gets on this cache.
53: */
54: public long getGets();
55:
56: /** Get the number of puts on this cache
57: * @return the number of puts
58: */
59: public long getPuts();
60:
61: /** Get the number of hits on this cache
62: * @return the number of hits
63: */
64: public long getHits();
65: }
66:
67: /*
68: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
69: *
70: * All rights reserved.
71: *
72: *
73: * Redistribution and use in source and binary forms, with or without
74: * modification, are permitted provided that the following conditions
75: * are met:
76: * 1. Redistributions of source code must retain the above copyright
77: * notice, this list of conditions and the following disclaimer.
78: * 2. Redistributions in binary form must reproduce the above copyright
79: * notice, this list of conditions and the following disclaimer in the
80: * documentation and/or other materials provided with the distribution.
81: * 3. The name of the author may not be used to endorse or promote products
82: * derived from this software without specific prior written permission.
83:
84: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
85: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
86: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
87: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
88: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
89: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
90: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
91: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
92: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
93: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94: *
95: * $Id: CacheControl.java,v 1.6 2008/01/02 12:10:16 andy_seaborne Exp $
96: */
|