All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.server.util.DiskCacheImpl

java.lang.Object
   |
   +----sun.server.util.DiskCacheImpl

public class DiskCacheImpl
extends Object
implements DiskCache

Constructor Index

 o DiskCacheImpl(String, int, CacheReplacer, int, int)

Method Index

 o dropReadLock(URLContents)
 o entries()
This returns an enumeration of cache entries in the cache i.e an enumeration of CacheEntry objects.
 o getReadLockedContents(URL, FetchContents)
This reads the cache entry for the URL.
 o remove(URL)
This method removes the url and its associated contents from the cache.
 o setMaxDiskCacheEntrySize(int)
 o setMaxRamCacheEntrySize(int)
 o setPath(String)
Set the path to the disk cache
 o setReplacementPolicy(CacheReplacer)
When files are to be replaced, the CacheReplacer chooses which enties must go.
 o setSize(int)
Set the size of the disk cache.

Constructors

 o DiskCacheImpl
  public DiskCacheImpl(String path,
                       int size,
                       CacheReplacer cr,
                       int maxRamCacheEntrySize,
                       int maxDiskCacheEntrySize)

Methods

 o setPath
  public void setPath(String fullPathName)
Set the path to the disk cache

Parameters:
fullPathName - the path to the place where the files are stored
 o setSize
  public void setSize(int sizeInBytes)
Set the size of the disk cache.

Parameters:
sizeInBytes - the total size of the disk cache in bytes.
 o setReplacementPolicy
  public void setReplacementPolicy(CacheReplacer cr)
When files are to be replaced, the CacheReplacer chooses which enties must go.

Parameters:
cr - the CacheReplacer object that dictates replacement policy.
 o setMaxRamCacheEntrySize
  public void setMaxRamCacheEntrySize(int maxEntrySize)
 o setMaxDiskCacheEntrySize
  public void setMaxDiskCacheEntrySize(int maxEntrySize)
 o getReadLockedContents
  public URLContents getReadLockedContents(URL url,
                                           FetchContents fc) throws IOException
This reads the cache entry for the URL. If the URL is cached, the contents of the cache is returned. Otherwise, the get method of the FetchContents interface is called to retrieve the contents in an application specific way. The contents returned by FetchContents are cached, and a copy is returned to the application.

Parameters:
url - - the url that must be read.
fc - - the FetchContents interface that must be implemented by the application. The get() method of the FetchContents interface is called when there is a cache miss.
Returns:
URLContentsImpl - the contents of the URL, either read from the cache or by calling FetchContents.
Throws: IOException
- an IOException occured while reading the URL contents.
 o dropReadLock
  public void dropReadLock(URLContents uc)
 o remove
  public void remove(URL url)
This method removes the url and its associated contents from the cache.

Parameters:
url - - this is the URL that has to be flushed from the cache.
 o entries
  public URLContents[] entries()
This returns an enumeration of cache entries in the cache i.e an enumeration of CacheEntry objects. This is a dirty read and represents a snapshot of the cache as it was when the call was made. This information can only used for reading the meta information and deciding which entries to replace. It is typically used by the CacheReplacer object.

Returns:
the list of CacheEntry in this cache.

All Packages  Class Hierarchy  This Package  Previous  Next  Index