Sha256: 5a7b123f5e6949aefc3669fad2d526ef537f9794b02844c0b65ba79f176b2c41

Contents?: true

Size: 853 Bytes

Versions: 22

Compression:

Stored size: 853 Bytes

Contents

# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.

module TraceView
  module API
    ##
    # Utility methods for the Memcache instrumentation
    module Memcache
      MEMCACHE_OPS = %w(add append cas decr decrement delete fetch get incr increment prepend replace set)

      def memcache_hit?(result)
        result.nil? ? 0 : 1
      end

      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)
        if server_as_array.is_a?(Array)
          server = server_as_array.first
          if is_unix_socket?(server)
            return 'localhost'
          elsif defined?(server.hostname)
            return server.hostname
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
traceview-3.3.3-java lib/traceview/api/memcache.rb
traceview-3.3.3 lib/traceview/api/memcache.rb
traceview-3.3.1-java lib/traceview/api/memcache.rb
traceview-3.3.1 lib/traceview/api/memcache.rb
traceview-3.3.0-java lib/traceview/api/memcache.rb
traceview-3.3.0 lib/traceview/api/memcache.rb
traceview-3.2.1-java lib/traceview/api/memcache.rb
traceview-3.2.1 lib/traceview/api/memcache.rb
traceview-3.1.0-java lib/traceview/api/memcache.rb
traceview-3.1.0 lib/traceview/api/memcache.rb
traceview-3.0.5-java lib/traceview/api/memcache.rb
traceview-3.0.5 lib/traceview/api/memcache.rb
traceview-3.0.4-java lib/traceview/api/memcache.rb
traceview-3.0.4 lib/traceview/api/memcache.rb
traceview-3.0.3-java lib/traceview/api/memcache.rb
traceview-3.0.3 lib/traceview/api/memcache.rb
traceview-3.0.2-java lib/traceview/api/memcache.rb
traceview-3.0.2 lib/traceview/api/memcache.rb
traceview-3.0.1-java lib/traceview/api/memcache.rb
traceview-3.0.1 lib/traceview/api/memcache.rb