Class RedisAPI

java.lang.Object
com.kamikazejam.kamicommon.redis.RedisAPI

public class RedisAPI extends Object
The handle for one Redis connection, exposing pub/sub channels alongside Lettuce's synchronous and asynchronous command interfaces. Obtain one from RedisConnector.getAPI(com.kamikazejam.kamicommon.redis.util.RedisConf); the constructor is not public, and every caller passing an equal RedisConf receives the same shared instance. shutdown() releases this caller's claim rather than closing the connection, and once the last holder has released it this instance is spent.
See Also:
  • Method Details

    • shutdown

      public void shutdown()
      Releases this caller's claim on the underlying Redis connection.

      Instances are shared: every caller passing an equal RedisConf receives the same object. The connection is closed once the last holder has called this, so a plugin shutting down no longer takes the connection away from anything else in the same JVM.

      Once the connection really is closed, this instance is spent. Call RedisConnector.getAPI(com.kamikazejam.kamicommon.redis.util.RedisConf) again for a fresh one rather than reusing this reference.

    • registerChannel

      @NotNull public @NotNull RedisChannel registerChannel(@NotNull @NotNull String channel)
    • registerMultiChannel

      @NotNull public @NotNull RedisMultiChannel registerMultiChannel(@NotNull @NotNull String... channels)
    • getCmdsSync

      public io.lettuce.core.api.sync.RedisCommands<String,String> getCmdsSync()
    • getCmdsAsync

      public io.lettuce.core.api.async.RedisAsyncCommands<String,String> getCmdsAsync()
    • getConnection

      public io.lettuce.core.api.StatefulRedisConnection<String,String> getConnection()
    • getState

      public RedisState getState()
    • isConnected

      public boolean isConnected()