Sha256: 5b0b299a51f7867cf86a63e2c72db5e5ab52bfc1b6c119c6537e3fe2b26b3389

Contents?: true

Size: 848 Bytes

Versions: 43

Compression:

Stored size: 848 Bytes

Contents

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

module Oboe
  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

43 entries across 43 versions & 1 rubygems

Version Path
oboe-2.7.19-java lib/oboe/api/memcache.rb
oboe-2.7.19 lib/oboe/api/memcache.rb
oboe-2.7.18-java lib/oboe/api/memcache.rb
oboe-2.7.18 lib/oboe/api/memcache.rb
oboe-2.7.17.1-java lib/oboe/api/memcache.rb
oboe-2.7.17.1 lib/oboe/api/memcache.rb
oboe-2.7.16.1 lib/oboe/api/memcache.rb
oboe-2.7.16.1-java lib/oboe/api/memcache.rb
oboe-2.7.15.1-java lib/oboe/api/memcache.rb
oboe-2.7.15.1 lib/oboe/api/memcache.rb
oboe-2.7.14.1-java lib/oboe/api/memcache.rb
oboe-2.7.14.1 lib/oboe/api/memcache.rb
oboe-2.7.13.3-java lib/oboe/api/memcache.rb
oboe-2.7.13.3 lib/oboe/api/memcache.rb
oboe-2.7.12.1-java lib/oboe/api/memcache.rb
oboe-2.7.12.1 lib/oboe/api/memcache.rb
oboe-2.7.11.1 lib/oboe/api/memcache.rb
oboe-2.7.11.1-java lib/oboe/api/memcache.rb
oboe-2.7.10.1-java lib/oboe/api/memcache.rb
oboe-2.7.10.1 lib/oboe/api/memcache.rb