KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > util > cache > CacheControl


1 /*
2  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  *
4  * All rights reserved.
5  *
6  * See end of file.
7  */

8
9 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     /** Get the number of puts on this cache
56      * @return the number of puts
57      */

58     public long getPuts();
59     /** Get the number of hits on this cache
60      * @return the number of hits
61      */

62     public long getHits();
63 }
64
65 /*
66  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
67  *
68  * All rights reserved.
69  *
70  *
71  * Redistribution and use in source and binary forms, with or without
72  * modification, are permitted provided that the following conditions
73  * are met:
74  * 1. Redistributions of source code must retain the above copyright
75  * notice, this list of conditions and the following disclaimer.
76  * 2. Redistributions in binary form must reproduce the above copyright
77  * notice, this list of conditions and the following disclaimer in the
78  * documentation and/or other materials provided with the distribution.
79  * 3. The name of the author may not be used to endorse or promote products
80  * derived from this software without specific prior written permission.
81
82  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
83  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
84  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
85  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
86  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
87  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
88  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
89  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
90  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
91  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
92  *
93  * $Id: CacheControl.java,v 1.3 2005/02/21 12:19:12 andy_seaborne Exp $
94  */

95
96
Popular Tags