Interface Cache

  • All Known Implementing Classes:
    BlockDirectoryCache

    public interface Cache
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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.
      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.
    • Method Detail

      • delete

        void delete​(String name)
        Remove a file from the cache.
        Parameters:
        name - cache file name
      • update

        void update​(String name,
                    long blockId,
                    int blockOffset,
                    byte[] buffer,
                    int offset,
                    int length)
        Update the content of the specified cache file. Creates cache entry if necessary.
      • fetch

        boolean fetch​(String name,
                      long blockId,
                      int blockOffset,
                      byte[] b,
                      int off,
                      int lengthToReadInBlock)
        Fetch the specified cache file content.
        Returns:
        true if cached content found, otherwise return false
      • size

        long size()
        Number of entries in the cache.
      • renameCacheFile

        void renameCacheFile​(String source,
                             String dest)
        Expert: Rename the specified file in the cache. Allows a file to be moved without invalidating the cache.
        Parameters:
        source - original name
        dest - final name
      • releaseResources

        void releaseResources()
        Release any resources associated with the cache.