Class FileCache<T>
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.util.FileCache<T>
- Type Parameters:
T
- the type of object to store.
File cache which can be used to store a java object in a file and load it from that file if the program runs a second time.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget()
Returns the instance which can be cached in file.getFile()
private void
loadFromFileOrUseSuplier
(Supplier<T> instanceSuplier) void
save()
Save instance to file now.void
Save instance to file when JVM terminates.void
Save instance to file when JVM terminates but only if cache file does not exists.void
Save instance to file now but only if cache file is not existent.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
file
-
instance
-
-
Constructor Details
-
FileCache
-
FileCache
-
FileCache
-
FileCache
-
-
Method Details
-
loadFromFileOrUseSuplier
-
load
-
get
Returns the instance which can be cached in file.- Returns:
- the instance
-
saveAtShutdown
public void saveAtShutdown()Save instance to file when JVM terminates. Call this function only once. -
saveAtShutdownIfCacheNotExistent
public void saveAtShutdownIfCacheNotExistent()Save instance to file when JVM terminates but only if cache file does not exists. Call this function only once. -
save
public void save()Save instance to file now. -
saveIfCacheNotExistent
public void saveIfCacheNotExistent()Save instance to file now but only if cache file is not existent. -
getFile
-