Sha256: f033153656d8adbafe4820cb9701c37452a968ed0fab1e151da578ced8b41093

Contents?: true

Size: 1020 Bytes

Versions: 37

Compression:

Stored size: 1020 Bytes

Contents

#--
# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.
#++

# TODO remove Memcache from API and into some Util module to be included in Modules that need
# ____ these methods
module AppOpticsAPM
  module API
    ##
    # Utility methods for the Memcache instrumentation
    # currently used by dalli and memcached
    module Memcache #:nodoc:
      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)

        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
    end
  end
end

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
appoptics_apm-zearn-4.13.1 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.13.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.12.2 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.12.1 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.12.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.11.2 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.11.1 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.11.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.10.1 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.10.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.9.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.8.4 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.8.3 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.8.2 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.8.1 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.8.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.7.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.6.0 lib/appoptics_apm/api/memcache.rb
appoptics_apm_mnfst-4.5.2 lib/appoptics_apm/api/memcache.rb
appoptics_apm-4.5.2 lib/appoptics_apm/api/memcache.rb