module IOPromise::Dalli::AsyncClient

Public Class Methods

new(servers = nil, options = {}) click to toggle source
Calls superclass method
# File lib/iopromise/dalli/patch_dalli.rb, line 9
def initialize(servers = nil, options = {})
  @async = options[:iopromise_async] == true

  super
end

Public Instance Methods

perform(*) click to toggle source
Calls superclass method
# File lib/iopromise/dalli/patch_dalli.rb, line 15
def perform(*)
  return super unless @async

  begin
    super
  rescue => ex
    # Wrap any connection errors into a promise, this is more forwards-compatible
    # if we ever attempt to make connecting/server fallback nonblocking too.
    Promise.new.tap { |p| p.reject(ex) }
  end
end