public final class DefaultFilenameFileReferenceValueManager extends AbstractFileValueManager<String,File>
PersistencesRestoreMethod.DELETE_ALL and PersistencesRestoreMethod.LOAD_WITHIN_EXPIRETIME, or when the key is expired or removed.File.getAbsolutePath()| Constructor and Description |
|---|
DefaultFilenameFileReferenceValueManager(CachingDirectory cachingDirectory,
PersistencesRestoreMethod persistencesRestoreMethod)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
File |
constructFile(String key,
File value)
Constructs a file using the Key and Value.
|
void |
flush()
This is ensures that any memory data that needs to be persisted is flushed.
|
String |
reconstructKey(File file)
When restoring a persisted LRUCachingMap, we need the ability to reconstruct the Key.
|
File |
retrieveValue(AbstractValueWrapper<String,File> valueWrapper)
Retrives value via the data contained in the ValueWrapper
|
void |
storeValue(AbstractValueWrapper<String,File> valueWrapper,
String key,
File value,
Date expireDateTime)
Stores the value and giving the ValueWrapper enough information to retrieve/remove it again.
|
cast, constructWrapper, getCachingDirectory, getFile, removeAll, removeValue, restore, updateExpireTimegetLogger, getPersistencesRestoreMethod, isPersistedpublic DefaultFilenameFileReferenceValueManager(CachingDirectory cachingDirectory, PersistencesRestoreMethod persistencesRestoreMethod) throws IllegalArgumentException, NullPointerException
cachingDirectory - the directory where to store the cached values.persistencesRestoreMethod - the restore method, when reconstructing the LRUCachingMap.IllegalArgumentException - if cachingDirectory isnt a valid directory.NullPointerException - if persistencesRestoreMethod or cachingDirectory is null.public void storeValue(AbstractValueWrapper<String,File> valueWrapper, String key, File value, Date expireDateTime) throws RuntimeException
ValueManagervalueWrapper - the wrapper instance to store the value or information about the value, this can be used to minimize the memory footprint.key - the keyvalue - the valueexpireDateTime - the expiration datetime for the key, this can be stored on a persisted key/value and used in case of a restore.RuntimeException - if for any reason the value could not be store.public File retrieveValue(AbstractValueWrapper<String,File> valueWrapper) throws RuntimeException
ValueManagervalueWrapper - theRuntimeException - if for any reason the value could not be retrieved.public String reconstructKey(File file)
AbstractFileValueManagerreconstructKey in class AbstractFileValueManager<String,File>file - the file.public File constructFile(String key, File value)
AbstractFileValueManagerconstructFile in class AbstractFileValueManager<String,File>key - the keyvalue - the valuepublic final void flush()
Copyright © 2016. All rights reserved.