public final class PropertyCacheFile extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_HASH_KEY
The property key to use for storing the hashcode of the
configuration.
|
static String |
EXTERNAL_RESOURCE_KEY_PREFIX
The property prefix to use for storing the hashcode of an
external resource.
|
Constructor and Description |
---|
PropertyCacheFile(Configuration config,
String fileName)
Creates a new
PropertyCacheFile instance. |
Modifier and Type | Method and Description |
---|---|
String |
get(String name)
Retrieves the hash of a specific file.
|
boolean |
isInCache(String uncheckedFileName,
long timestamp)
Checks that file is in cache.
|
void |
load()
Load cached values from file.
|
void |
persist()
Cleans up the object and updates the cache file.
|
void |
put(String checkedFileName,
long timestamp)
Records that a file checked ok.
|
void |
putExternalResources(Set<String> locations)
Puts external resources in cache.
|
void |
remove(String checkedFileName)
Removed a specific file from the cache.
|
void |
reset()
Resets the cache to be empty except for the configuration hash.
|
public static final String CONFIG_HASH_KEY
public static final String EXTERNAL_RESOURCE_KEY_PREFIX
public PropertyCacheFile(Configuration config, String fileName)
PropertyCacheFile
instance.config
- the current configuration, not nullfileName
- the cache fileIllegalArgumentException
- when either arguments are nullpublic void load() throws IOException
IOException
- when there is a problems with file readpublic void persist() throws IOException
IOException
- when there is a problems with file savepublic void reset()
public boolean isInCache(String uncheckedFileName, long timestamp)
uncheckedFileName
- the file to checktimestamp
- the timestamp of the file to checkpublic void put(String checkedFileName, long timestamp)
checkedFileName
- name of the file that checked oktimestamp
- the timestamp of the filepublic String get(String name)
name
- The name of the file to retrieve.null
.public void remove(String checkedFileName)
checkedFileName
- The name of the file to remove.public void putExternalResources(Set<String> locations)
locations
- locations of external resources.Copyright © 2001–2020. All rights reserved.