Package org.ngengine.store
Class DataStore
java.lang.Object
org.ngengine.store.DataStore
A data store is key-value storage that can be used to store $
Savable and serializable objects and
primitives to a persistent storage.
It uses VStore internally and differentiates between cache and data stores, however the actual
implementation is platform dependent and will use whatever form of storage is the most appropriate and
efficient for the platform and the intended use case.
-
Constructor Summary
ConstructorsConstructorDescriptionDataStore(String appName, AssetManager assetManager, String name, boolean isCache) -
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes a key from the store.booleanChecks if a key exists in the store.org.ngengine.platform.VStorelist()Clears the store, deleting all keys.<T extends Savable>
TReads a savable or serializable object or a primitive from the store.voidFully writes and commits a savable or serializable object or a primitive.
-
Constructor Details
-
DataStore
-
-
Method Details
-
getVStore
public org.ngengine.platform.VStore getVStore() -
write
Fully writes and commits a savable or serializable object or a primitive.- Parameters:
key- the key to store the object undervalue- the object to store, must be aSavableor serializable object- Throws:
IOException
-
read
Reads a savable or serializable object or a primitive from the store.- Parameters:
key- the key to read the object from- Returns:
- the object read from the store, can be a
Savableor a serializable object - Throws:
IOException- if reading fails
-
exists
Checks if a key exists in the store.- Parameters:
key- the key to check- Returns:
- true if the key exists, false otherwise
-
delete
Deletes a key from the store.- Parameters:
key- the key to delete
-
list
Clears the store, deleting all keys. -
listAsync
-