KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > db > impl > ICache


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

7
8
9 //=======================================================================
10
// Package
11
package com.hp.hpl.jena.db.impl;
12
13 //=======================================================================
14
/**
15 * Interface signature for cache implementations. Instances of this are
16 * used to cache resources and literals loaded from a database.
17 * <p>The type of the stored objects is left generic in case other caches
18 * are needed but could specialize it to RDFNodes.
19 *
20 * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
21 * @version $Revision: 1.4 $ on $Date: 2005/02/21 12:02:53 $
22 */

23
24
25 public interface ICache {
26
27     /**
28      * Add an entry to the cache
29      * @param id the database ID to be used as an index
30      * @param val the literal or resources to be stored
31      */

32     public void put(IDBID id, Object JavaDoc val);
33
34     /**
35      * Retreive an object from the cache
36      * @param id the database ID of the object to be retrieved
37      * @return the object or null if it is not in the cache
38      */

39     public Object JavaDoc get(IDBID id);
40
41     /**
42      * Set a threshold for the cache size in terms of the count of cache entries.
43      * For literals a storage limit rather than a count might be more useful but
44      * counts are easier, more general and sufficient for the current use.
45      *
46      * @param threshold the cache size limit, use 0 for no cache, -1 for
47      * unlimited cache growth; any other number indicates the number of cache entries
48      */

49     public void setLimit(int threshold);
50
51     /**
52      * Return the current threshold limit for the cache size.
53      */

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

83
Popular Tags