-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1267 from supercaracal/fix-cluster-cli
Keep compatibilities as possible for the transaction feature between a standalone client and a cluster client
- Loading branch information
Showing
6 changed files
with
149 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require 'irb' | ||
require 'bundler/setup' | ||
require 'redis/cluster' | ||
|
||
IRB.start(File.expand_path('..', __dir__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'redis_client/cluster/transaction' | ||
|
||
class Redis | ||
class Cluster | ||
class TransactionAdapter < RedisClient::Cluster::Transaction | ||
def initialize(client, router, command_builder, node: nil, slot: nil, asking: false) | ||
@client = client | ||
super(router, command_builder, node: node, slot: slot, asking: asking) | ||
end | ||
|
||
def multi | ||
yield self | ||
end | ||
|
||
def exec | ||
# no need to do anything | ||
end | ||
|
||
def discard | ||
# no need to do anything | ||
end | ||
|
||
def watch(*_) | ||
# no need to do anything | ||
end | ||
|
||
def unwatch | ||
# no need to do anything | ||
end | ||
|
||
private | ||
|
||
def method_missing(name, *args, **kwargs, &block) | ||
return call(name, *args, **kwargs, &block) if @client.respond_to?(name) | ||
|
||
super | ||
end | ||
|
||
def respond_to_missing?(name, include_private = false) | ||
return true if @client.respond_to?(name) | ||
|
||
super | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters