KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > module > scancacheInterface


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.module;
11
12 import javax.servlet.http.HttpServletResponse JavaDoc;
13
14 import org.mmbase.util.scanpage;
15
16 /**
17  * File cache system interface.
18  * System for caching texts (it stores and retrieves strings) by use of a key.
19  * While in theory it is possible to cache ANY text, this is mainly used to store pages
20  * based on their url.<br />
21  * Caching is done in pools. Each pool has its own memory cache and files, and has
22  * different ways to handle file caching.
23  *
24  * @application SCAN
25  * @rename SCANCacheInterface
26  * @author Daniel Ockeloen
27  * @author Pierre van Rooden (javadocs)
28  * @version $Id: scancacheInterface.java,v 1.13 2004/10/01 08:42:47 pierre Exp $
29  */

30 public interface scancacheInterface {
31     /**
32      * Initializes the module.
33      * Also defined in ModuleInterface, so why is it in here?
34      */

35     public void init();
36
37     /**
38      * Retrieve a file from the indicated pool's cache.
39      * @param poolname name of the cache pool
40      * @param key key under which the content was cached
41      * @return the cached content as a string, or <code>null</code> if no entry was found
42      * (i.e. cache was empty or poolname was invalid).
43      */

44     public String JavaDoc get(String JavaDoc pool,String JavaDoc key,scanpage sp);
45
46     /**
47      * Retrieve a file from the indicated pool's cache.
48      * @param poolname name of the cache pool
49      * @param key key under which the content was cached
50      * @param line options for retrieving, such as an expiration value
51      * @return the cached content as a string, or <code>null</code> if no entry was found
52      * (i.e. cache was empty or poolname was invalid).
53      */

54     public String JavaDoc get(String JavaDoc pool,String JavaDoc key,String JavaDoc line,scanpage sp);
55
56         /**
57          * getExpireDate.
58          * @param poolName
59          * @param key
60          * @param expireStr
61          * @return long
62          */

63         public long getExpireDate(String JavaDoc poolName, String JavaDoc key, String JavaDoc expireStr);
64
65         /**
66          * getLastModDate.
67          * @param poolName
68          * @param key
69          * @return long
70          */

71         public long getLastModDate(String JavaDoc poolName, String JavaDoc key);
72
73     /**
74      * Retrieve a file from the indicated pool's cache.
75      * @param poolname name of the cache pool
76      * @param key key under which the content was cached
77      * @param line options for retrieving the cache
78      * @return the cached content as a string, or <code>null</code> if no entry was found
79      * (i.e. cache was empty or poolname was invalid).
80      */

81 // public String getNew(String pool,String key,String line,scanpage sp);
82

83     /**
84      * Store a file in the indicated pool's cache.
85      * Returns the old value if available.
86      * @param poolname name of the cache pool
87      * @param key key under which the content was cached
88      * @param value content to store
89      * @return the old cached content as a string, or <code>null</code> if no entry was found
90      */

91     public String JavaDoc put(String JavaDoc pool,String JavaDoc key,String JavaDoc value);
92
93     /**
94      * Store a file in the indicated pool's cache.
95      * Returns the old value if available.
96      * @param poolname name of the cache pool
97      * @param res reponse object for retrieving headers (used by mmbase.org?)
98      * @param key key under which the content was cached
99      * @param value content to store
100      * @param mimeType the content's mime type
101      * @return the old cached content as a string, or <code>null</code> if no entry was found
102      */

103     public String JavaDoc newput(String JavaDoc pool,HttpServletResponse JavaDoc res,String JavaDoc key,String JavaDoc value, String JavaDoc mimeType);
104
105     /**
106      * Store a file in the indicated pool's cache.
107      * Returns the old value if available.
108      * @param poolname name of the cache pool
109      * @param key key under which the content was cached
110      * @param value content to store
111      * @param cachetype only needed for cachepool "PAGE".
112      * If 0, no file transfer is performed. Otherwise the {@link org.mmbase.module.builders.NetFileSrv} builder is
113      * invoked to start the VWM that handles the transfer.
114      * @param mimeType the page's mime type, only needed for cachepool "PAGE"
115      * @return the old cached content as a string, or <code>null</code> if no entry was found
116      * @deprecated Temporary hack for solving asis problems (?). Use {@link #newput} instead.
117      */

118     public String JavaDoc newput2(String JavaDoc pool,String JavaDoc key,String JavaDoc value, int cachetype, String JavaDoc mimeType);
119
120     /**
121      * Removes an entry from the cache pool.
122      * @param pool name of cache pool
123      * @param key key of the content to remove
124      */

125     public void remove(String JavaDoc poolName, String JavaDoc key);
126 }
127
Popular Tags