Class: Redis::Cluster::TransactionAdapter
- Inherits:
-
Object
- Object
- Redis::Cluster::TransactionAdapter
show all
- Defined in:
- lib/redis/cluster/transaction_adapter.rb
Defined Under Namespace
Classes: Internal
Instance Method Summary
collapse
Constructor Details
#initialize(client, router, command_builder, node: nil, slot: nil, asking: false) ⇒ TransactionAdapter
Returns a new instance of TransactionAdapter.
49
50
51
52
53
54
55
56
57
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 49
def initialize(client, router, command_builder, node: nil, slot: nil, asking: false)
@client = client
@router = router
@command_builder = command_builder
@node = node
@slot = slot
@asking = asking
@lock_released = false
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object
91
92
93
94
95
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 91
def method_missing(name, *args, **kwargs, &block)
return @client.public_send(name, *args, **kwargs, &block) if @client.respond_to?(name)
super
end
|
Instance Method Details
#discard ⇒ Object
76
77
78
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 76
def discard
end
|
#exec ⇒ Object
72
73
74
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 72
def exec
end
|
#lock_released? ⇒ Boolean
59
60
61
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 59
def lock_released?
@lock_released
end
|
#multi {|transaction| ... } ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 63
def multi
@lock_released = true
transaction = Redis::Cluster::TransactionAdapter::Internal.new(
@client, @router, @command_builder, node: @node, slot: @slot, asking: @asking
)
yield transaction
transaction.execute
end
|
#unwatch ⇒ Object
84
85
86
87
|
# File 'lib/redis/cluster/transaction_adapter.rb', line 84
def unwatch
@lock_released = true
@node.call('UNWATCH')
end
|