Class YAMLDialect
java.lang.Object
xyz.srnyx.annoyingapi.storage.dialects.Dialect
xyz.srnyx.annoyingapi.storage.dialects.YAMLDialect
Data dialect for JSON database
-
Nested Class Summary
Nested classes/interfaces inherited from class xyz.srnyx.annoyingapi.storage.dialects.Dialect
Dialect.MigrationData -
Field Summary
Fields inherited from class xyz.srnyx.annoyingapi.storage.dialects.Dialect
dataManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ValuegetFromCacheImpl(@NotNull String table, @NotNull String target, @NotNull String key) Get a value from the cachegetFromDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull String key) Get a value from the databaseprotected @NotNull Optional<Dialect.MigrationData> getMigrationDataFromDatabaseImpl(@NotNull DataManager newManager) Get migration data from the databasevoidmarkRemovedInCacheImpl(@NotNull String table, @NotNull String target, @NotNull String key) Mark a value as removed in the cacheprotected booleanremoveFromDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull String key) Remove a value from the databasevoidSave all cache data to the databasevoidsaveCacheImpl(@NotNull String table, @NotNull String target) Save a specific target in a table to the cachevoidsetToCacheImpl(@NotNull String table, @NotNull String target, @NotNull String key, @NotNull Value value) Set a value to the cacheprotected @Nullable FailedSetsetToDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull String key, @NotNull String value) Set a value to the databasesetToDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull ConcurrentHashMap<String, Value> data) Set multiple values to the databaseMethods inherited from class xyz.srnyx.annoyingapi.storage.dialects.Dialect
getFromCache, getFromDatabase, getMigrationDataFromDatabase, markRemovedInCache, removeValueFromDatabase, saveCache, saveCache, setToCache, setToDatabase, setToDatabase, setToDatabase
-
Constructor Details
-
YAMLDialect
Creates a new H2 dialect- Parameters:
dataManager-Dialect.dataManager
-
-
Method Details
-
getFromCacheImpl
@Nullable public @Nullable Value getFromCacheImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String key) Description copied from class:DialectGet a value from the cache- Specified by:
getFromCacheImplin classDialect- Parameters:
table- the tabletarget- the targetkey- the key- Returns:
- the value inside a
Value, null if it isn't cached
-
setToCacheImpl
public void setToCacheImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String key, @NotNull @NotNull Value value) Description copied from class:DialectSet a value to the cache- Specified by:
setToCacheImplin classDialect- Parameters:
table- the tabletarget- the targetkey- the keyvalue- the value inside aValue
-
markRemovedInCacheImpl
public void markRemovedInCacheImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String key) Description copied from class:DialectMark a value as removed in the cache- Specified by:
markRemovedInCacheImplin classDialect- Parameters:
table- the tabletarget- the targetkey- the key
-
saveCacheImpl
public void saveCacheImpl()Description copied from class:DialectSave all cache data to the database- Specified by:
saveCacheImplin classDialect
-
saveCacheImpl
Description copied from class:DialectSave a specific target in a table to the cache- Specified by:
saveCacheImplin classDialect- Parameters:
table- the table to save intarget- the target to save
-
getMigrationDataFromDatabaseImpl
@NotNull protected @NotNull Optional<Dialect.MigrationData> getMigrationDataFromDatabaseImpl(@NotNull @NotNull DataManager newManager) Description copied from class:DialectGet migration data from the database- Specified by:
getMigrationDataFromDatabaseImplin classDialect- Parameters:
newManager- the newDataManagerto migrate to- Returns:
- the migration data, empty if something went wrong
-
getFromDatabaseImpl
@NotNull protected @NotNull Optional<String> getFromDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String key) Description copied from class:DialectGet a value from the database- Specified by:
getFromDatabaseImplin classDialect- Parameters:
table- the table to get fromtarget- the target to get fromkey- the key to get- Returns:
- the value, empty if not found
-
setToDatabaseImpl
@Nullable protected @Nullable FailedSet setToDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String key, @NotNull @NotNull String value) Description copied from class:DialectSet a value to the database- Specified by:
setToDatabaseImplin classDialect- Parameters:
table- the table to set totarget- the target to set tokey- the key to setvalue- the value to set- Returns:
- the failed value information, null if successful
-
setToDatabaseImpl
@NotNull protected @NotNull Set<FailedSet> setToDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull ConcurrentHashMap<String, Value> data) Description copied from class:DialectSet multiple values to the database- Specified by:
setToDatabaseImplin classDialect- Parameters:
table- the table to set totarget- the target to set todata- the data to set- Returns:
- set of failed values as
FailedSets
-
removeFromDatabaseImpl
protected boolean removeFromDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String key) Description copied from class:DialectRemove a value from the database- Specified by:
removeFromDatabaseImplin classDialect- Parameters:
table- the table to remove fromtarget- the target to remove fromkey- the key to remove- Returns:
- true if the value was successfully removed, false otherwise
-