com.groupdocs.viewer.caching

Class FileCache

  • All Implemented Interfaces:
    Cache


    public class FileCache
    extends Object
    implements Cache

    Represents a local on-disk cache.

    • Constructor Detail

      • FileCache

        public FileCache(String cachePath)

        Creates new instance of FileCache class.

        Parameters:
        cachePath - Relative or absolute path where document cache will be stored.
        Throws:
        IllegalArgumentException - Thrown when cachePath is null.
      • FileCache

        public FileCache(String cachePath,
                 String cacheSubFolder)

        Creates new instance of FileCache class.

        Parameters:
        cachePath - Relative or absolute path where document cache will be stored.
        cacheSubFolder - The sub-folder to append to cachePath.
        Throws:
        IllegalArgumentException - Thrown when cachePath is null.
        IllegalArgumentException - Thrown when cacheSubFolder is null.
    • Method Detail

      • get

        public final Object get(String key)

        Deserializes data associated with this key if present.

        Specified by:
        get in interface Cache
        Parameters:
        key - A key identifying the requested entry.
        Returns:
        The located value or null.
      • getCachePath

        public final String getCachePath()
        The Relative or absolute path to the cache folder.
        Returns:
        The Relative or absolute path to the cache folder.
      • getKeys

        public final List<String> getKeys(String filter)

        Returns all file names that contains filter in filename.

        Specified by:
        getKeys in interface Cache
        Parameters:
        filter - The filter to use.
        Returns:
        File names that contains filter in filename.
      • set

        public final void set(String key,
               Object value)

        Serializes data to the local disk.

        Specified by:
        set in interface Cache
        Parameters:
        key - An unique identifier for the cache entry.
        value - The object to serialize.