class Memcached

Public Instance Methods

get(key, marshal = true)
Also aliased as: get_without_benchmark
Alias for: get_with_benchmark
get_with_benchmark(key, marshal = true) click to toggle source
# File lib/time_bandits/monkey_patches/memcached.rb, line 9
def get_with_benchmark(key, marshal = true)
  ActiveSupport::Notifications.instrument("get.memcached") do |payload|
    if key.is_a?(Array)
      payload[:reads] = (num_keys = key.size)
      results = []
      begin
        results = get_without_benchmark(key, marshal)
      rescue Memcached::NotFound
      end
      payload[:misses] = num_keys - results.size
      results
    else
      val = nil
      payload[:reads] = 1
      begin
        val = get_without_benchmark(key, marshal)
      rescue Memcached::NotFound
      end
      payload[:misses] = val.nil? ? 1 : 0
      val
    end
  end
end
Also aliased as: get
get_without_benchmark(key, marshal = true)
Alias for: get
set(*args)
Also aliased as: set_without_benchmark
Alias for: set_with_benchmark
set_with_benchmark(*args) click to toggle source
# File lib/time_bandits/monkey_patches/memcached.rb, line 35
def set_with_benchmark(*args)
  ActiveSupport::Notifications.instrument("set.memcached") do
    set_without_benchmark(*args)
  end
end
Also aliased as: set
set_without_benchmark(*args)
Alias for: set