KickJava   Java API By Example, From Geeks To Geeks.

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


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 /** 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 JavaDoc get(Object JavaDoc key);
35     /** Store an object in the cache
36      * @param key the key for the object being stored
37      * @param value the object stored under the key
38      *
39      */

40     public void put(Object JavaDoc key, Object JavaDoc value);
41 }
42
43 /*
44  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
45  *
46  * All rights reserved.
47  *
48  *
49  * Redistribution and use in source and binary forms, with or without
50  * modification, are permitted provided that the following conditions
51  * are met:
52  * 1. Redistributions of source code must retain the above copyright
53  * notice, this list of conditions and the following disclaimer.
54  * 2. Redistributions in binary form must reproduce the above copyright
55  * notice, this list of conditions and the following disclaimer in the
56  * documentation and/or other materials provided with the distribution.
57  * 3. The name of the author may not be used to endorse or promote products
58  * derived from this software without specific prior written permission.
59
60  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
61  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
62  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
63  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
64  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
65  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
66  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
67  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
68  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
69  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70  *
71  * $Id: Cache.java,v 1.4 2005/02/21 12:19:12 andy_seaborne Exp $
72  */

73
74
Popular Tags