Class Dialect

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Dialect.MigrationData
      Data for a database migration
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method 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
      @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
      @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
      @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
      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
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dataManager

        @NotNull
        protected final @NotNull DataManager dataManager
        The DataManager to use for database operations
    • Method Detail

      • getFromCache

        @Nullable
        public @Nullable Value getFromCache​(@NotNull
                                            @NotNull java.lang.String table,
                                            @NotNull
                                            @NotNull java.lang.String target,
                                            @NotNull
                                            @NotNull java.lang.String key)
        Get a value from the cache
        Parameters:
        table - the table to get from
        target - the target to get from
        key - the key to get
        Returns:
        the value, empty if not found
      • setToCache

        public void setToCache​(@NotNull
                               @NotNull java.lang.String table,
                               @NotNull
                               @NotNull java.lang.String target,
                               @NotNull
                               @NotNull java.lang.String key,
                               @Nullable
                               @Nullable Value value)
        Set a value to the cache
        Parameters:
        table - the table
        target - the target
        key - the key
        value - the value
      • markRemovedInCache

        public void markRemovedInCache​(@NotNull
                                       @NotNull java.lang.String table,
                                       @NotNull
                                       @NotNull java.lang.String target,
                                       @NotNull
                                       @NotNull java.lang.String key)
        Mark a value as removed in the cache
        Parameters:
        table - the table
        target - the target
        key - the key
      • saveCache

        public void saveCache()
        Save all cache data to the database
      • saveCache

        public void saveCache​(@NotNull
                              @NotNull java.lang.String table,
                              @NotNull
                              @NotNull java.lang.String target)
        Save a specific target in a table to the cache
        Parameters:
        table - the table to save in
        target - the target to save
      • getMigrationDataFromDatabase

        @NotNull
        public final @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabase​(@NotNull
                                                                                                     @NotNull DataManager newManager)
        Get migration data from the database
        Parameters:
        newManager - the new DataManager to migrate to
        Returns:
        the migration data, empty if something went wrong
      • getFromDatabase

        @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)
        Get a value from the database
        Parameters:
        table - the table
        target - the target
        key - the key
        Returns:
        the value, empty if not found
      • setToDatabase

        @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)
        Set a value to the database
        Parameters:
        table - the table
        target - the target
        key - the key
        value - the value
        Returns:
        the failed value information, null if successful
      • setToDatabase

        @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)
        Set a value to the database
        Parameters:
        table - the table
        target - the target
        data - the data to set
        Returns:
        set of failed values as FailedSets
      • setToDatabase

        @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)
        Set multiple values to the database
        Parameters:
        data - the data to set
        Returns:
        set of failed values as FailedSets
      • removeValueFromDatabase

        public final boolean removeValueFromDatabase​(@NotNull
                                                     @NotNull java.lang.String table,
                                                     @NotNull
                                                     @NotNull java.lang.String target,
                                                     @NotNull
                                                     @NotNull java.lang.String key)
        Remove a value from the database
        Parameters:
        table - the table
        target - the target
        key - the key
        Returns:
        true if the value was successfully removed, false otherwise
      • getFromCacheImpl

        @Nullable
        protected abstract @Nullable Value getFromCacheImpl​(@NotNull
                                                            @NotNull java.lang.String table,
                                                            @NotNull
                                                            @NotNull java.lang.String target,
                                                            @NotNull
                                                            @NotNull java.lang.String key)
        Get a value from the cache
        Parameters:
        table - the table
        target - the target
        key - the key
        Returns:
        the value inside a Value, null if it isn't cached
      • setToCacheImpl

        protected 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)
        Set a value to the cache
        Parameters:
        table - the table
        target - the target
        key - the key
        value - the value inside a Value
      • markRemovedInCacheImpl

        protected abstract void markRemovedInCacheImpl​(@NotNull
                                                       @NotNull java.lang.String table,
                                                       @NotNull
                                                       @NotNull java.lang.String target,
                                                       @NotNull
                                                       @NotNull java.lang.String key)
        Mark a value as removed in the cache
        Parameters:
        table - the table
        target - the target
        key - the key
      • saveCacheImpl

        protected abstract void saveCacheImpl()
        Save all cache data to the database
      • saveCacheImpl

        protected abstract void saveCacheImpl​(@NotNull
                                              @NotNull java.lang.String table,
                                              @NotNull
                                              @NotNull java.lang.String target)
        Save a specific target in a table to the cache
        Parameters:
        table - the table to save in
        target - the target to save
      • getMigrationDataFromDatabaseImpl

        @NotNull
        protected abstract @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabaseImpl​(@NotNull
                                                                                                               @NotNull DataManager newManager)
        Get migration data from the database
        Parameters:
        newManager - the new DataManager to migrate to
        Returns:
        the migration data, empty if something went wrong
      • getFromDatabaseImpl

        @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)
        Get a value from the database
        Parameters:
        table - the table to get from
        target - the target to get from
        key - the key to get
        Returns:
        the value, empty if not found
      • setToDatabaseImpl

        @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)
        Set a value to the database
        Parameters:
        table - the table to set to
        target - the target to set to
        key - the key to set
        value - the value to set
        Returns:
        the failed value information, null if successful
      • setToDatabaseImpl

        @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)
        Set multiple values to the database
        Parameters:
        table - the table to set to
        target - the target to set to
        data - the data to set
        Returns:
        set of failed values as FailedSets
      • removeFromDatabaseImpl

        protected abstract boolean removeFromDatabaseImpl​(@NotNull
                                                          @NotNull java.lang.String table,
                                                          @NotNull
                                                          @NotNull java.lang.String target,
                                                          @NotNull
                                                          @NotNull java.lang.String key)
        Remove a value from the database
        Parameters:
        table - the table to remove from
        target - the target to remove from
        key - the key to remove
        Returns:
        true if the value was successfully removed, false otherwise