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: /** A caching store for objects.
12: *
13: * <p>A caching store will hold on to some objects for some
14: * time, but may fail to store them. It is used as an
15: * optimization, so that objects that have already been
16: * constructed, need not be made again. The null object
17: * should not be stored under a key as there is no way
18: * to distingish this from a missing object.</p>
19: *
20: * <p>Cache objects are usually created using the {@link CacheManager }.</p>
21: *
22: * <p>An object is associated with a key which is used to
23: * identify the object on retrieval. Only one object may be
24: * associated with a key.</p>
25: *
26: * @author bwm
27: */
28: public interface Cache extends CacheControl {
29: /** Get and object from the cache, if it is there.
30: * @param key the key for the object sought
31: * @return the object associated with the key, or null if
32: * the key is not found in the cache
33: */
34: public Object get(Object key);
35:
36: /** Store an object in the cache
37: * @param key the key for the object being stored
38: * @param value the object stored under the key
39: *
40: */
41: public void put(Object key, Object value);
42: }
43:
44: /*
45: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
46: *
47: * All rights reserved.
48: *
49: *
50: * Redistribution and use in source and binary forms, with or without
51: * modification, are permitted provided that the following conditions
52: * are met:
53: * 1. Redistributions of source code must retain the above copyright
54: * notice, this list of conditions and the following disclaimer.
55: * 2. Redistributions in binary form must reproduce the above copyright
56: * notice, this list of conditions and the following disclaimer in the
57: * documentation and/or other materials provided with the distribution.
58: * 3. The name of the author may not be used to endorse or promote products
59: * derived from this software without specific prior written permission.
60:
61: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
62: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
63: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
64: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
65: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
66: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
67: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
68: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
69: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
70: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71: *
72: * $Id: Cache.java,v 1.7 2008/01/02 12:10:16 andy_seaborne Exp $
73: */
|