Class: Redis::Cluster::TransactionAdapter::Internal

Inherits:
RedisClient::Cluster::Transaction
  • Object
show all
Defined in:
lib/redis/cluster/transaction_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, router, command_builder, node: nil, slot: nil, asking: false) ⇒ Internal

Returns a new instance of Internal.



9
10
11
12
# File 'lib/redis/cluster/transaction_adapter.rb', line 9

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **kwargs, &block) ⇒ Object (private)



36
37
38
39
40
# File 'lib/redis/cluster/transaction_adapter.rb', line 36

def method_missing(name, *args, **kwargs, &block)
  return call(name, *args, **kwargs, &block) if @client.respond_to?(name)

  super
end

Instance Method Details

#discardObject



22
23
24
# File 'lib/redis/cluster/transaction_adapter.rb', line 22

def discard
  # no need to do anything
end

#execObject



18
19
20
# File 'lib/redis/cluster/transaction_adapter.rb', line 18

def exec
  # no need to do anything
end

#multiObject



14
15
16
# File 'lib/redis/cluster/transaction_adapter.rb', line 14

def multi
  raise(Redis::Cluster::TransactionConsistencyError, "Can't nest multi transaction")
end

#unwatchObject



30
31
32
# File 'lib/redis/cluster/transaction_adapter.rb', line 30

def unwatch
  # no need to do anything
end

#watch(*_) ⇒ Object



26
27
28
# File 'lib/redis/cluster/transaction_adapter.rb', line 26

def watch(*_)
  raise(Redis::Cluster::TransactionConsistencyError, "Can't use watch in a transaction")
end