-
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.
Keep compatibilities as possible with a standalone client for the tra…
…nsaction feature in a cluster client
- Loading branch information
1 parent
cdfe172
commit 123ba4b
Showing
5 changed files
with
130 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
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,49 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'redis-cluster-client' | ||
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 nothing | ||
end | ||
|
||
def discard | ||
# no need to do nothing | ||
end | ||
|
||
def watch(*_) | ||
# no need to do nothing | ||
end | ||
|
||
def unwatch | ||
# no need to do nothing | ||
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