KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > storage > Cache


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// Copyright (C) 2003-@year@, Leo Mekenkamp. All rights reserved.
5
//
6
// $Id: Cache.java,v 1.1 2003/12/31 13:51:23 per_nyfelt Exp $
7

8 package org.ozoneDB.core.storage;
9
10 import java.util.Collection JavaDoc;
11 import java.util.Map JavaDoc;
12
13 /**
14  * A cache works a bit like a map. The difference is that for all key-object
15  * pairs put into the cache there is no assurance whatsoever that those
16  * key-object pairs will stay in the cache.
17  * More specifically: given the fact that the last time
18  * the put-method was called for a key K was with value O, then any subsequent
19  * calls to the get-method with key K will either result in object O being
20  * returned, or null. Once a null has been returned for key K, a null value will
21  * always be returned for key K, until K is used again in <code>put()</code>.
22  *
23  * @author <a HREF="mailto:leoATmekenkampD0Tcom">Leo Mekenkamp (mind the anti sp@m)</a>
24  * @version $Id: Cache.java,v 1.1 2003/12/31 13:51:23 per_nyfelt Exp $
25  */

26 public interface Cache {
27     
28     /**
29      * Puts an object into the cache, along with its identifying key.
30      */

31     public void put(Object JavaDoc key, Object JavaDoc value);
32     
33     /**
34      * Returns the object in this cache for the given key.
35      */

36     public Object JavaDoc get(Object JavaDoc key);
37     
38     /**
39      * Returns the object in this cache for the given key and removes it from
40      * the cache.
41      */

42     public Object JavaDoc remove(Object JavaDoc key);
43     
44     public Map JavaDoc copyToMap();
45
46     public int size();
47     
48 }
49
50
Popular Tags