V
- the value typepublic abstract class AbstractFilenameFileValueManager<V> extends AbstractFileValueManager<String,V>
file.getName()
. Constructor and Description |
---|
AbstractFilenameFileValueManager(CachingDirectory cachingDirectory,
PersistencesRestoreMethod persistencesRestoreMethod)
Constructor
|
Modifier and Type | Method and Description |
---|---|
File |
constructFile(String key,
V 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)
Reconstructs the key which is the filename.
|
abstract V |
retrieveFileValue(DefaultFileValueWrapper<String,V> valueWrapper)
Loads the value from the file in valueWrapper.
|
V |
retrieveValue(AbstractValueWrapper<String,V> valueWrapper)
Retrives value via the data contained in the ValueWrapper
|
abstract void |
storeFileValue(DefaultFileValueWrapper<String,V> valueWrapper,
String key,
V value)
This method shall the take the Value and stored it in a file given by the valueWrapper.
|
void |
storeValue(AbstractValueWrapper<String,V> valueWrapper,
String key,
V value,
Date expireDateTime)
Stores the value and giving the ValueWrapper enough information to retrieve/remove it again.
|
cast, constructWrapper, getCachingDirectory, getFile, removeAll, removeValue, restore, updateExpireTime
getLogger, getPersistencesRestoreMethod, isPersisted
public AbstractFilenameFileValueManager(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 cacheDirectory isnt a valid directory.NullPointerException
- if persistencesRestoreMethod or cachingDirectory is null
.public final String reconstructKey(File file)
reconstructKey
in class AbstractFileValueManager<String,V>
file
- the file.File.getName()
public final File constructFile(String key, V value)
AbstractFileValueManager
constructFile
in class AbstractFileValueManager<String,V>
key
- the keyvalue
- the valuepublic final void storeValue(AbstractValueWrapper<String,V> valueWrapper, String key, V value, Date expireDateTime) throws RuntimeException
valueWrapper
- 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.storeFileValue(DefaultFileValueWrapper, String, Object)
,
AbstractFileValueManager.updateExpireTime(AbstractValueWrapper, Date)
public final V retrieveValue(AbstractValueWrapper<String,V> valueWrapper) throws RuntimeException
ValueManager
valueWrapper
- theRuntimeException
- if for any reason the value could not be retrieved.public void flush()
public abstract void storeFileValue(DefaultFileValueWrapper<String,V> valueWrapper, String key, V value) throws RuntimeException
valueWrapper
- the value wrapper which holds the file.key
- the key.value
- the value.RuntimeException
- if the value can not be stored in the file.public abstract V retrieveFileValue(DefaultFileValueWrapper<String,V> valueWrapper)
valueWrapper
- the value wrapperCopyright © 2016. All rights reserved.