Class MongoDbStorageProvider<K,V>
java.lang.Object
dev.crafty.core.storage.AbstractStorageProvider<K,V>
dev.crafty.core.storage.providers.MongoDbStorageProvider<K,V>
- All Implemented Interfaces:
StorageProvider<K,
V>
-
Field Summary
Fields inherited from class dev.crafty.core.storage.AbstractStorageProvider
valueType
-
Constructor Summary
ConstructorsConstructorDescriptionMongoDbStorageProvider
(Class<V> valueType, String tableName, String connectionUrl) -
Method Summary
Modifier and TypeMethodDescriptionDeletes an object from the storage.Retrieves an object from the storage.getAll()
Retrieves all objects from the storage.Initializes the storage provider.Saves an object to the storage.Methods inherited from class dev.crafty.core.storage.AbstractStorageProvider
close, exists, serializeKey
-
Constructor Details
-
MongoDbStorageProvider
-
-
Method Details
-
initialize
Description copied from interface:StorageProvider
Initializes the storage provider. This method should be called before using the provider.- Specified by:
initialize
in interfaceStorageProvider<K,
V> - Overrides:
initialize
in classAbstractStorageProvider<K,
V> - Returns:
- A CompletableFuture that completes when initialization is done
-
save
Description copied from interface:StorageProvider
Saves an object to the storage.- Parameters:
key
- The key to identify the objectvalue
- The object to save- Returns:
- A CompletableFuture that completes when the operation is done
-
get
Description copied from interface:StorageProvider
Retrieves an object from the storage.- Parameters:
key
- The key of the object to retrieve- Returns:
- A CompletableFuture that completes with the retrieved object, or empty if not found
-
getAll
Description copied from interface:StorageProvider
Retrieves all objects from the storage.- Returns:
- A CompletableFuture that completes with a collection of all objects
-
delete
Description copied from interface:StorageProvider
Deletes an object from the storage.- Parameters:
key
- The key of the object to delete- Returns:
- A CompletableFuture that completes when the operation is done
-