Class: RedisCluster::Future

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_cluster/future.rb

Overview

Future basically act the same way as Redis::Future with some modification

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slot, command, transformation) ⇒ Future

Returns a new instance of Future.



12
13
14
15
16
17
18
# File 'lib/redis_cluster/future.rb', line 12

def initialize(slot, command, transformation)
  @slot = slot
  @command = command
  @transformation = transformation
  @value = Redis::Future::FutureNotReady
  @asking = false
end

Instance Attribute Details

#askingObject

Returns the value of attribute asking.



10
11
12
# File 'lib/redis_cluster/future.rb', line 10

def asking
  @asking
end

#commandObject (readonly)

Returns the value of attribute command.



9
10
11
# File 'lib/redis_cluster/future.rb', line 9

def command
  @command
end

#slotObject (readonly)

Returns the value of attribute slot.



9
10
11
# File 'lib/redis_cluster/future.rb', line 9

def slot
  @slot
end

#urlObject

Returns the value of attribute url.



10
11
12
# File 'lib/redis_cluster/future.rb', line 10

def url
  @url
end

Instance Method Details

#valueObject

Raises:



20
21
22
23
# File 'lib/redis_cluster/future.rb', line 20

def value
  raise @value if @value.is_a?(::RuntimeError)
  @value
end

#value=(value) ⇒ Object



25
26
27
# File 'lib/redis_cluster/future.rb', line 25

def value=(value)
  @value = @transformation.call(value)
end