org.apache.solr.store.blockcache

## Class BlockDirectoryCache

- java.lang.Object
- - org.apache.solr.store.blockcache.BlockDirectoryCache

- All Implemented Interfaces:
    Cache

      public class BlockDirectoryCache
      extends Object
      implements Cache

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockDirectoryCache(BlockCache blockCache, String path, Metrics metrics)`
    `BlockDirectoryCache(BlockCache blockCache, String path, Metrics metrics, boolean releaseBlocks)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `delete(String name)` Remove a file from the cache.
    `boolean` | `fetch(String name, long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock)` Fetch the specified cache file content.
    `BlockCache` | `getBlockCache()` Expert: mostly for tests
    `void` | `releaseResources()` Release any resources associated with the cache.
    `void` | `renameCacheFile(String source, String dest)` Expert: Rename the specified file in the cache.
    `long` | `size()` Number of entries in the cache.
    `void` | `update(String name, long blockId, int blockOffset, byte[] buffer, int offset, int length)` Update the content of the specified cache file.

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

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

- - ### Constructor Detail

    - #### BlockDirectoryCache

          public BlockDirectoryCache(BlockCache blockCache,
                                     String path,
                                     Metrics metrics)

    - #### BlockDirectoryCache

          public BlockDirectoryCache(BlockCache blockCache,
                                     String path,
                                     Metrics metrics,
                                     boolean releaseBlocks)

  - ### Method Detail

    - #### getBlockCache

          public BlockCache getBlockCache()

      Expert: mostly for tests
      WARNING: This API is experimental and might change in incompatible ways in the next release.

    - #### delete

          public void delete(String name)

      Description copied from interface: `Cache`
      Remove a file from the cache.
      Specified by:
        `delete` in interface `Cache`
      Parameters:
        `name` - cache file name

    - #### update

          public void update(String name,
                             long blockId,
                             int blockOffset,
                             byte[] buffer,
                             int offset,
                             int length)

      Description copied from interface: `Cache`
      Update the content of the specified cache file. Creates cache entry if necessary.
      Specified by:
        `update` in interface `Cache`

    - #### fetch

          public boolean fetch(String name,
                               long blockId,
                               int blockOffset,
                               byte[] b,
                               int off,
                               int lengthToReadInBlock)

      Description copied from interface: `Cache`
      Fetch the specified cache file content.
      Specified by:
        `fetch` in interface `Cache`
      Returns:
        true if cached content found, otherwise return false

    - #### size

          public long size()

      Description copied from interface: `Cache`
      Number of entries in the cache.
      Specified by:
        `size` in interface `Cache`

    - #### renameCacheFile

          public void renameCacheFile(String source,
                                      String dest)

      Description copied from interface: `Cache`
      Expert: Rename the specified file in the cache. Allows a file to be moved without invalidating the cache.
      Specified by:
        `renameCacheFile` in interface `Cache`
      Parameters:
        `source` - original name
        `dest` - final name

    - #### releaseResources

          public void releaseResources()

      Description copied from interface: `Cache`
      Release any resources associated with the cache.
      Specified by:
        `releaseResources` in interface `Cache`

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