com.datumbox.framework.storage.inmemory
Class InMemoryEngine
- java.lang.Object
-
- com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine<SC>
-
- com.datumbox.framework.common.storage.abstracts.AbstractFileStorageEngine<InMemoryConfiguration>
-
- com.datumbox.framework.storage.inmemory.InMemoryEngine
-
- All Implemented Interfaces:
- StorageEngine, java.lang.AutoCloseable
public class InMemoryEngine extends AbstractFileStorageEngine<InMemoryConfiguration>
The InMemoryEngine is responsible for saving and loading data in memory, creating BigMaps and storing data. The InMemoryEngine loads all the data in memory and stores all data in serialized files.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.datumbox.framework.common.storage.interfaces.StorageEngine
StorageEngine.MapType, StorageEngine.StorageHint
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()Clears all the data stored in the storage while keeping the connection open.voidclose()<T extends java.util.Map>
voiddropBigMap(java.lang.String name, T map)Drops the Big Map.booleanexistsObject(java.lang.String name)Checks if an object exists with the particular name.<K,V> java.util.Map<K,V>getBigMap(java.lang.String name, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary)Creates or loads a Big Map collection.<T extends java.io.Serializable>
TloadObject(java.lang.String name, java.lang.Class<T> klass)Loads a serializable object from the storage.booleanrename(java.lang.String newStorageName)Renames the storage.<T extends java.io.Serializable>
voidsaveObject(java.lang.String name, T serializableObject)Stores a serializable object in the storage.-
Methods inherited from class com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine
getStorageName, isClosed
-
-
-
-
Method Detail
-
rename
public boolean rename(java.lang.String newStorageName)
Renames the storage. Returns true if the operation was completed and false if it was not necessary.- Returns:
-
existsObject
public boolean existsObject(java.lang.String name)
Checks if an object exists with the particular name.- Returns:
-
saveObject
public <T extends java.io.Serializable> void saveObject(java.lang.String name, T serializableObject)Stores a serializable object in the storage.
-
loadObject
public <T extends java.io.Serializable> T loadObject(java.lang.String name, java.lang.Class<T> klass) throws java.util.NoSuchElementExceptionLoads a serializable object from the storage.- Returns:
- Throws:
java.util.NoSuchElementException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classAbstractStorageEngine<InMemoryConfiguration>
-
clear
public void clear()
Clears all the data stored in the storage while keeping the connection open.
-
getBigMap
public <K,V> java.util.Map<K,V> getBigMap(java.lang.String name, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary)Creates or loads a Big Map collection.- Returns:
-
dropBigMap
public <T extends java.util.Map> void dropBigMap(java.lang.String name, T map)Drops the Big Map.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG