org.eclipse.jetty.server

## Class ResourceCache

- java.lang.Object
- - org.eclipse.jetty.server.ResourceCache

-     public class ResourceCache
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ResourceCache.Content` MetaData associated with a context Resource.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes)` Constructor.
    `ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes, boolean useFileMappedBuffer)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `flushCache()`
    `int` | `getCachedFiles()`
    `int` | `getCachedSize()`
    `protected Buffer` | `getDirectBuffer(Resource resource)`
    `protected Buffer` | `getIndirectBuffer(Resource resource)`
    `int` | `getMaxCachedFiles()`
    `int` | `getMaxCachedFileSize()`
    `int` | `getMaxCacheSize()`
    `protected boolean` | `isCacheable(Resource resource)`
    `boolean` | `isUseFileMappedBuffer()`
    `HttpContent` | `lookup(String pathInContext)` Get a Entry from the cache.
    `void` | `setMaxCachedFiles(int maxCachedFiles)`
    `void` | `setMaxCachedFileSize(int maxCachedFileSize)`
    `void` | `setMaxCacheSize(int maxCacheSize)`
    `void` | `setUseFileMappedBuffer(boolean useFileMappedBuffer)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ResourceCache

          public ResourceCache(ResourceCache parent,
                       ResourceFactory factory,
                       MimeTypes mimeTypes,
                       boolean useFileMappedBuffer)

    - #### ResourceCache

          public ResourceCache(ResourceCache parent,
                       ResourceFactory factory,
                       MimeTypes mimeTypes)

      Constructor.
      Parameters:
        `mimeTypes` - Mimetype to use for meta data

  - ### Method Detail

    - #### getCachedSize

          public int getCachedSize()

    - #### getCachedFiles

          public int getCachedFiles()

    - #### getMaxCachedFileSize

          public int getMaxCachedFileSize()

    - #### setMaxCachedFileSize

          public void setMaxCachedFileSize(int maxCachedFileSize)

    - #### getMaxCacheSize

          public int getMaxCacheSize()

    - #### setMaxCacheSize

          public void setMaxCacheSize(int maxCacheSize)

    - #### getMaxCachedFiles

          public int getMaxCachedFiles()

      Returns:
        Returns the maxCachedFiles.

    - #### setMaxCachedFiles

          public void setMaxCachedFiles(int maxCachedFiles)

      Parameters:
        `maxCachedFiles` - The maxCachedFiles to set.

    - #### isUseFileMappedBuffer

          public boolean isUseFileMappedBuffer()

    - #### setUseFileMappedBuffer

          public void setUseFileMappedBuffer(boolean useFileMappedBuffer)

    - #### flushCache

          public void flushCache()

    - #### lookup

          public HttpContent lookup(String pathInContext)
                             throws IOException

      Get a Entry from the cache. Get either a valid entry object or create a new one if possible.
      Parameters:
        `pathInContext` - The key into the cache
      Returns:
        The entry matching `pathInContext`, or a new entry if no matching entry was found. If the content exists but is not cachable, then a `HttpContent.ResourceAsHttpContent` instance is return. If the resource does not exist, then null is returned.
      Throws:
        `IOException` - Problem loading the resource

    - #### isCacheable

          protected boolean isCacheable(Resource resource)

      Parameters:
        `resource` -
      Returns:
        True if the resource is cacheable. The default implementation tests the cache sizes.

    - #### getIndirectBuffer

          protected Buffer getIndirectBuffer(Resource resource)

    - #### getDirectBuffer

          protected Buffer getDirectBuffer(Resource resource)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.