01: /*
02: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: *
05: *
06: */
07:
08: //=======================================================================
09: // Package
10: package com.hp.hpl.jena.db.impl;
11:
12: //=======================================================================
13: /**
14: * Interface signature for cache implementations. Instances of this are
15: * used to cache resources and literals loaded from a database.
16: * <p>The type of the stored objects is left generic in case other caches
17: * are needed but could specialize it to RDFNodes.
18: *
19: * @author <a href="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
20: * @version $Revision: 1.7 $ on $Date: 2008/01/02 12:08:24 $
21: */
22:
23: public interface ICache {
24:
25: /**
26: * Add an entry to the cache
27: * @param id the database ID to be used as an index
28: * @param val the literal or resources to be stored
29: */
30: public void put(IDBID id, Object val);
31:
32: /**
33: * Retreive an object from the cache
34: * @param id the database ID of the object to be retrieved
35: * @return the object or null if it is not in the cache
36: */
37: public Object get(IDBID id);
38:
39: /**
40: * Set a threshold for the cache size in terms of the count of cache entries.
41: * For literals a storage limit rather than a count might be more useful but
42: * counts are easier, more general and sufficient for the current use.
43: *
44: * @param threshold the cache size limit, use 0 for no cache, -1 for
45: * unlimited cache growth; any other number indicates the number of cache entries
46: */
47: public void setLimit(int threshold);
48:
49: /**
50: * Return the current threshold limit for the cache size.
51: */
52: public int getLimit();
53: }
54:
55: /*
56: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
57: * All rights reserved.
58: *
59: * Redistribution and use in source and binary forms, with or without
60: * modification, are permitted provided that the following conditions
61: * are met:
62: * 1. Redistributions of source code must retain the above copyright
63: * notice, this list of conditions and the following disclaimer.
64: * 2. Redistributions in binary form must reproduce the above copyright
65: * notice, this list of conditions and the following disclaimer in the
66: * documentation and/or other materials provided with the distribution.
67: * 3. The name of the author may not be used to endorse or promote products
68: * derived from this software without specific prior written permission.
69:
70: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
71: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
72: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
73: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
74: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
75: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
76: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
77: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
78: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
79: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80: */
|