org.apache.jetspeed.cache.disk
Interface DiskCache

All Known Implementing Classes:
JetspeedDiskCache

public interface DiskCache

A way to store remote documents locally. This can increase performance by eliminating TCP connection latency.

All implementations of a DiskCache should implement this interface.

Version:
$Id: DiskCache.java,v 1.15 2004/02/23 02:45:29 jford Exp $
Author:
Kevin A. Burton, Santiago Gala

Method Summary
 void add(java.lang.String url)
          Add this URL to the disk cache
 java.lang.String fetch(java.lang.String url, java.lang.String destination)
          Get the URL from the Internet and then place it in the File dest.
 DiskCacheEntry[] getEntries()
          Get a list of all the documents within the cache...
 DiskCacheEntry getEntry(java.lang.String url)
           Take the given remove URL and place it in the disk cache.
 DiskCacheEntry getEntry(java.lang.String url, boolean force)
          Get an Entry from the from the cache but force this URL to be fetched and then cached no matter what configuration options Jetspeed provides.
 DiskCacheEntry getEntry(java.lang.String url, java.io.Reader is)
          Get a entry based on a URL but you should already have the content.
 java.lang.String getRoot()
          Return the root of this DiskCache.
 boolean isCached(java.lang.String url)
          Ask if a url is in the DiskCache
 void refresh(java.lang.String url)
          Tell the DiskCache that this URL should be refreshed.
 void remove(java.lang.String url)
          Remove this URL from the disk cache.
 

Method Detail

getEntry

public DiskCacheEntry getEntry(java.lang.String url)
                        throws java.io.IOException

Take the given remove URL and place it in the disk cache. Additionaly operations include building a DiskCacheEntry and then returning it.

getEntry may attempt to pull down the URL if it is not in the disk cache. Most implementations may provide support for changing this behavior so that you have to explicitly call add. This is done for performance reasons so that HTTP clients don't end up triggering a URL connection to fetch the given URL.

Throws:
java.io.IOException

getEntry

public DiskCacheEntry getEntry(java.lang.String url,
                               boolean force)
                        throws java.io.IOException

Get an Entry from the from the cache but force this URL to be fetched and then cached no matter what configuration options Jetspeed provides.

Throws:
java.io.IOException
See Also:
getEntry( String url )

getEntry

public DiskCacheEntry getEntry(java.lang.String url,
                               java.io.Reader is)
                        throws java.io.IOException
Get a entry based on a URL but you should already have the content. This is usually used to specify an alternative Reader (maybe StringReader).

getEntry may attempt to pull down the URL if it is not in the disk cache. Most implementations may provide support for changing this behavior so that you have to explicitly call add. This is done for performance reasons so that HTTP clients don't end up triggering a URL connection to fetch the given URL.

Throws:
java.io.IOException

getEntries

public DiskCacheEntry[] getEntries()
Get a list of all the documents within the cache...


add

public void add(java.lang.String url)
         throws java.io.IOException
Add this URL to the disk cache

Throws:
java.io.IOException

remove

public void remove(java.lang.String url)
            throws java.io.IOException
Remove this URL from the disk cache.

Throws:
java.io.IOException

fetch

public java.lang.String fetch(java.lang.String url,
                              java.lang.String destination)
                       throws java.io.IOException
Get the URL from the Internet and then place it in the File dest.

Throws:
java.io.IOException

getRoot

public java.lang.String getRoot()
Return the root of this DiskCache.


refresh

public void refresh(java.lang.String url)
Tell the DiskCache that this URL should be refreshed. This will do this in a threaded and asynchronous manner.


isCached

public boolean isCached(java.lang.String url)
Ask if a url is in the DiskCache



Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.