Class: IOPromise::Memcached::MemcachePromise

Inherits:
Base
  • Object
show all
Defined in:
lib/iopromise/memcached/promise.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#beginning, #fulfill, #instrument, #notify_completion, #reject, #started_executing?

Constructor Details

#initialize(client = nil, key = nil) ⇒ MemcachePromise

Returns a new instance of MemcachePromise.



10
11
12
13
14
15
16
17
# File 'lib/iopromise/memcached/promise.rb', line 10

def initialize(client = nil, key = nil)
  super()
    
  @client = client
  @key = key
    
  ::IOPromise::ExecutorContext.current.register(self) unless @client.nil? || @key.nil?
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/iopromise/memcached/promise.rb', line 8

def key
  @key
end

Instance Method Details

#execute_poolObject



27
28
29
# File 'lib/iopromise/memcached/promise.rb', line 27

def execute_pool
  MemcacheExecutorPool.for(@client)
end

#waitObject



19
20
21
22
23
24
25
# File 'lib/iopromise/memcached/promise.rb', line 19

def wait
  if @client.nil? || @key.nil?
    super
  else
    ::IOPromise::ExecutorContext.current.wait_for_all_data(end_when_complete: self)
  end
end