K - the key type.V - the value type.public class DefaultGroupJPAEntityValueManager<K extends Serializable,V extends Serializable> extends AbstractPersistenceValueManager<K,V>
CachedGroupJPAEntityRepository.| Constructor and Description |
|---|
DefaultGroupJPAEntityValueManager(CachedGroupJPAEntityRepository<K,V> repository,
PersistencesRestoreMethod persistencesRestoreMethod)
Constructor.
|
DefaultGroupJPAEntityValueManager(String group,
Class<? extends CachedGroupJPAEntity<K,V>> clazz,
javax.persistence.EntityManagerFactory entityManagerFactory,
PersistencesRestoreMethod persistencesRestoreMethod)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected CachedGroupJPAEntity<K,V> |
constructEntity(K key,
V value,
Date expireDateTime)
Constructs an instance of "CachedGroupJPAEntity" clazz.
|
AbstractValueWrapper<K,V> |
constructWrapper(K key,
V value)
Construct a ValueWrapper for the value, but do not sets the value, this is done either in "restore" or "storeValue"
|
void |
flush()
This is ensures that any memory data that needs to be persisted is flushed.
|
CachedGroupJPAEntityRepository<K,V> |
getRepository()
Gets the "CachedGroupJPAEntityRepository" instance.
|
int |
removeAll()
Remove all persisted values from the value "storage".
|
void |
removeValue(AbstractValueWrapper<K,V> valueWrapper)
Removes the value
|
void |
restore(LRUCachingMap<K,V> map)
Restores any persisted key/values to the LRUCachingMap when the map is constructed.
|
V |
retrieveValue(AbstractValueWrapper<K,V> valueWrapper)
Retrives value via the data contained in the ValueWrapper
|
void |
storeValue(AbstractValueWrapper<K,V> valueWrapper,
K key,
V value,
Date expireDateTime)
Stores the value and giving the ValueWrapper enough information to retrieve/remove it again.
|
void |
updateExpireTime(AbstractValueWrapper<K,V> valueWrapper,
Date expireDateTime)
Update the expiration date time for a value.
|
getLogger, getPersistencesRestoreMethod, isPersistedpublic DefaultGroupJPAEntityValueManager(CachedGroupJPAEntityRepository<K,V> repository, PersistencesRestoreMethod persistencesRestoreMethod) throws IllegalArgumentException, NullPointerException
repository - an instance of CachedGroupJPAEntityRepositorypersistencesRestoreMethod - the persistencesRestoreMethodIllegalArgumentException - if repository is invalid.NullPointerException - if either repository or persistencesRestoreMethod is null.public DefaultGroupJPAEntityValueManager(String group, Class<? extends CachedGroupJPAEntity<K,V>> clazz, javax.persistence.EntityManagerFactory entityManagerFactory, PersistencesRestoreMethod persistencesRestoreMethod) throws IllegalArgumentException, NullPointerException
group - the group name, none empty.clazz - the class instance of CachedGroupJPAEntity.entityManagerFactory - the entityManagerFactory.persistencesRestoreMethod - the persistencesRestoreMethodIllegalArgumentException - if repository is invalid.NullPointerException - if either repository or persistencesRestoreMethod is null.public CachedGroupJPAEntityRepository<K,V> getRepository()
public final void restore(LRUCachingMap<K,V> map)
ValueManagermap - the map instance.LRUCachingMap.restoreCacheElement(Object, AbstractValueWrapper, Date),
PersistencesRestoreMethod,
AbstractPersistenceValueManager,
ValueManager.flush()public final int removeAll()
ValueManagerpublic final AbstractValueWrapper<K,V> constructWrapper(K key, V value)
ValueManagerkey - the keyvalue - the valueValueManager.restore(LRUCachingMap),
ValueManager.storeValue(AbstractValueWrapper, Object, Object, Date)public final void removeValue(AbstractValueWrapper<K,V> valueWrapper) throws RuntimeException
ValueManagerRuntimeException - if for any reason the value could not be removed.public final V retrieveValue(AbstractValueWrapper<K,V> valueWrapper) throws RuntimeException
ValueManagervalueWrapper - theRuntimeException - if for any reason the value could not be retrieved.public final void storeValue(AbstractValueWrapper<K,V> valueWrapper, K key, V 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 void updateExpireTime(AbstractValueWrapper<K,V> valueWrapper, Date expireDateTime) throws RuntimeException
ValueManagervalueWrapper - the wrapper which holds enough information to get the value.expireDateTime - the new expireDateTimeRuntimeException - if this for any reasons fails.public void flush()
protected CachedGroupJPAEntity<K,V> constructEntity(K key, V value, Date expireDateTime) throws RuntimeException
key - the keyvalue - the valueexpireDateTime - the expiration datetime.RuntimeException - if the instance could not be created.Copyright © 2016. All rights reserved.