module TraceView::API::Memcache

Utility methods for the Memcache instrumentation

Constants

MEMCACHE_OPS

Public Instance Methods

memcache_hit?(result) click to toggle source
# File lib/traceview/api/memcache.rb, line 11
def memcache_hit?(result)
  result.nil? ? 0 : 1
end
remote_host(key) click to toggle source
# File lib/traceview/api/memcache.rb, line 15
def remote_host(key)
  return unless defined?(Lib.memcached_server_by_key) &&
                defined?(@struct) && defined?(is_unix_socket?)

  server_as_array = Lib.memcached_server_by_key(@struct, key.to_s)

  return unless server_as_array.is_a?(Array)

  server = server_as_array.first
  if is_unix_socket?(server)
    'localhost'
  elsif defined?(server.hostname)
    server.hostname
  end
end