KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > projector > store > Cache


1 package org.apache.slide.projector.store;
2
3 import java.io.IOException JavaDoc;
4 import java.util.HashMap JavaDoc;
5 import java.util.Map JavaDoc;
6
7 public class Cache extends AbstractStore {
8     private static Cache cache = new Cache();
9     private Map JavaDoc map;
10
11     public static Cache getInstance() {
12         return cache;
13     }
14
15     public Cache() {
16         map = new HashMap JavaDoc();
17     }
18     
19     public void setMap(Map JavaDoc map) {
20         this.map = map;
21     }
22     
23     public Map JavaDoc getMap() {
24         return map;
25     }
26     
27     public void put(String JavaDoc key, Object JavaDoc value) throws IOException JavaDoc {
28         map.put(key, value);
29     }
30
31     public Object JavaDoc get(String JavaDoc key) throws IOException JavaDoc {
32         return map.get(key);
33     }
34
35     public void dispose(String JavaDoc key) throws IOException JavaDoc {
36         map.remove(key);
37     }
38 }
Popular Tags