FileCache

Inheritance: java.lang.Object

All Implemented Interfaces: com.groupdocs.viewer.caching.Cache

public class FileCache implements Cache

Represents a local on-disk cache.

Constructors

Constructor Description
FileCache(String cachePath) Creates new instance of FileCache class.
FileCache(String cachePath, String cacheSubFolder) Creates new instance of FileCache class.

Methods

Method Description
getCachePath() The Relative or absolute path to the cache folder.
getCacheSubFolder() The sub-folder to append to the #getCachePath().getCachePath().
set(String key, Object value) Serializes data to the local disk.
get(String key) Deserializes data associated with this key if present.
getKeys(String filter) Returns all file names that contains filter in filename.

FileCache(String cachePath)

public FileCache(String cachePath)

Creates new instance of FileCache class.

Parameters:

Parameter Type Description
cachePath java.lang.String Relative or absolute path where document cache will be stored.

FileCache(String cachePath, String cacheSubFolder)

public FileCache(String cachePath, String cacheSubFolder)

Creates new instance of FileCache class.

Parameters:

Parameter Type Description
cachePath java.lang.String Relative or absolute path where document cache will be stored.
cacheSubFolder java.lang.String The sub-folder to append to cachePath .

getCachePath()

public final String getCachePath()

The Relative or absolute path to the cache folder.

Returns: java.lang.String - The Relative or absolute path to the cache folder.

getCacheSubFolder()

public final String getCacheSubFolder()

The sub-folder to append to the #getCachePath().getCachePath().

Returns: java.lang.String - The sub-folder to append to the #getCachePath().getCachePath().

set(String key, Object value)

public final void set(String key, Object value)

Serializes data to the local disk.

Parameters:

Parameter Type Description
key java.lang.String An unique identifier for the cache entry.
value java.lang.Object The object to serialize.

get(String key)

public final T <T>get(String key)

Deserializes data associated with this key if present.

Parameters:

Parameter Type Description
key java.lang.String A key identifying the requested entry.

Returns: T - The located value or null.

getKeys(String filter)

public final List<String> getKeys(String filter)

Returns all file names that contains filter in filename.

Parameters:

Parameter Type Description
filter java.lang.String The filter to use.

Returns: java.util.List<java.lang.String> - File names that contains filter in filename.