public interface CacheService extends Module
An interface for caching services. Pages, which can be any content really, can be stored in the cache using cache keys. The key is just any string that identifies the cached page. The pages are then retrieved using the same keys. In addition, timestamps in milliseconds can be used so that cached pages older than a specified value are not reused.
It is vital that the InputStreams and OutputStreams returned by getPage and storePage be properly closed in all cases, even if exceptions are encountered. Failing to do so may cause the cache to remain in a locked state and other threads be unable to use it.
See CachedAction for an abstract action that can take advantage of caching services.
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getPage(java.lang.String key,
long modifyTime)
Gets a cached version of a page if one exists in the cache.
|
java.io.OutputStream |
storePage(java.lang.String key,
long modifyTime)
Stores a cached version of a page with the given time stamp.
|
getDependencies, init, isInitialized, isRunning, start, stop
java.io.InputStream getPage(java.lang.String key, long modifyTime)
key
- The key of the cached page.modifyTime
- The minimum caching time of the page, or 0 if no such limit is used.java.io.OutputStream storePage(java.lang.String key, long modifyTime)
key
- The key of the cached page.modifyTime
- A timestamp for the cached version.Copyright 2004-2015 Wandora Team