public abstract class Dialect
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Dialect.MigrationData
Data for a database migration
|
| Modifier and Type | Field and Description |
|---|---|
protected @NotNull DataManager |
dataManager
The
DataManager to use for database operations |
| Constructor and Description |
|---|
Dialect(@NotNull DataManager dataManager)
Construct a new
Dialect with the given DataManager |
| Modifier and Type | Method and Description |
|---|---|
@Nullable Value |
getFromCache(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the cache
|
protected abstract @Nullable Value |
getFromCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the cache
|
@NotNull java.util.Optional<java.lang.String> |
getFromDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the database
|
protected abstract @NotNull java.util.Optional<java.lang.String> |
getFromDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Get a value from the database
|
@NotNull java.util.Optional<Dialect.MigrationData> |
getMigrationDataFromDatabase(@NotNull DataManager newManager)
Get migration data from the database
|
protected abstract @NotNull java.util.Optional<Dialect.MigrationData> |
getMigrationDataFromDatabaseImpl(@NotNull DataManager newManager)
Get migration data from the database
|
void |
markRemovedInCache(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Mark a value as removed in the cache
|
protected abstract void |
markRemovedInCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Mark a value as removed in the cache
|
protected abstract boolean |
removeFromDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Remove a value from the database
|
boolean |
removeValueFromDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key)
Remove a value from the database
|
void |
saveCache()
Save all cache data to the database
|
void |
saveCache(@NotNull java.lang.String table,
@NotNull java.lang.String target)
Save a specific target in a table to the cache
|
protected abstract void |
saveCacheImpl()
Save all cache data to the database
|
protected abstract void |
saveCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target)
Save a specific target in a table to the cache
|
void |
setToCache(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@Nullable Value value)
Set a value to the cache
|
protected abstract void |
setToCacheImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@NotNull Value value)
Set a value to the cache
|
@NotNull java.util.Set<FailedSet> |
setToDatabase(@NotNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,Value>>> data)
Set multiple values to the database
|
@NotNull java.util.Set<FailedSet> |
setToDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.util.concurrent.ConcurrentHashMap<java.lang.String,Value> data)
Set a value to the database
|
@Nullable FailedSet |
setToDatabase(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set a value to the database
|
protected abstract @NotNull java.util.Set<FailedSet> |
setToDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.util.concurrent.ConcurrentHashMap<java.lang.String,Value> data)
Set multiple values to the database
|
protected abstract @Nullable FailedSet |
setToDatabaseImpl(@NotNull java.lang.String table,
@NotNull java.lang.String target,
@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set a value to the database
|
@NotNull protected final @NotNull DataManager dataManager
DataManager to use for database operationspublic Dialect(@NotNull
@NotNull DataManager dataManager)
Dialect with the given DataManagerdataManager - dataManager@Nullable public @Nullable Value getFromCache(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String target, @NotNull @NotNull java.lang.String key)
table - the table to get fromtarget - the target to get fromkey - the key to getpublic void setToCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key,
@Nullable
@Nullable Value value)
table - the tabletarget - the targetkey - the keyvalue - the valuepublic void markRemovedInCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keypublic void saveCache()
public void saveCache(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target)
table - the table to save intarget - the target to save@NotNull public final @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabase(@NotNull @NotNull DataManager newManager)
newManager - the new DataManager to migrate to@NotNull
public final @NotNull java.util.Optional<java.lang.String> getFromDatabase(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the key@Nullable public final @Nullable FailedSet setToDatabase(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String target, @NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
table - the tabletarget - the targetkey - the keyvalue - the value@NotNull public final @NotNull java.util.Set<FailedSet> setToDatabase(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String target, @NotNull @NotNull java.util.concurrent.ConcurrentHashMap<java.lang.String,Value> data)
table - the tabletarget - the targetdata - the data to setFailedSets@NotNull public final @NotNull java.util.Set<FailedSet> setToDatabase(@NotNull @NotNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,Value>>> data)
data - the data to setFailedSetspublic final boolean removeValueFromDatabase(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the key@Nullable protected abstract @Nullable Value getFromCacheImpl(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String target, @NotNull @NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keyValue, null if it isn't cachedprotected abstract void setToCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull Value value)
table - the tabletarget - the targetkey - the keyvalue - the value inside a Valueprotected abstract void markRemovedInCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the tabletarget - the targetkey - the keyprotected abstract void saveCacheImpl()
protected abstract void saveCacheImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target)
table - the table to save intarget - the target to save@NotNull protected abstract @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabaseImpl(@NotNull @NotNull DataManager newManager)
newManager - the new DataManager to migrate to@NotNull
protected abstract @NotNull java.util.Optional<java.lang.String> getFromDatabaseImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the table to get fromtarget - the target to get fromkey - the key to get@Nullable protected abstract @Nullable FailedSet setToDatabaseImpl(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String target, @NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
table - the table to set totarget - the target to set tokey - the key to setvalue - the value to set@NotNull protected abstract @NotNull java.util.Set<FailedSet> setToDatabaseImpl(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String target, @NotNull @NotNull java.util.concurrent.ConcurrentHashMap<java.lang.String,Value> data)
table - the table to set totarget - the target to set todata - the data to setFailedSetsprotected abstract boolean removeFromDatabaseImpl(@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String target,
@NotNull
@NotNull java.lang.String key)
table - the table to remove fromtarget - the target to remove fromkey - the key to remove