Skip to content

Instantly share code, notes, and snippets.

@mp911de
Created September 25, 2017 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mp911de/44ef067a465b9eb4ce0c19edb3760bc9 to your computer and use it in GitHub Desktop.
Save mp911de/44ef067a465b9eb4ce0c19edb3760bc9 to your computer and use it in GitHub Desktop.
Accessing CommandHandler buffers in Lettuce 4
RedisClient redisClient = RedisClient.create(RedisURI.Builder.redis("localhost", 6379).build());
StatefulRedisConnection<String, String> redis = redisClient.connect();
RedisChannelHandler<String, String> channelHandler = (RedisChannelHandler) redis;
CommandHandler<String, String> commandHandler = (CommandHandler) channelHandler.getChannelWriter();
Collection<RedisCommand<String, String, ?>> disconnectedBuffer = null; // reflective access to commandHandler.disconnectedBuffer
Collection<RedisCommand<String, String, ?>> commandBuffer = null; // reflective access to commandHandler.commandBuffer
RedisClusterClient clusterClient = RedisClusterClient.create(RedisURI.Builder.redis("localhost", 6379).build());
StatefulRedisClusterConnection<String, String> cluster = clusterClient.connect();
StatefulRedisConnection<String, String> host = cluster.getConnection("host", 6379);
// from here, see above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment