Sha256: bb7ac3cf0660b231e5cd6406e63bcf342730514488ee9625262a5fc335ff0816

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

module Sinatra
  module MemcachedConnection
    def setup_memcached host, port
      @memcached = Dalli::Client.new("#{host}:#{port}")
    end

    def close_memcached
      @memcached.close
    end

    def memcached_connected? host, port
      begin
        Net::Telnet::new("Host" => host, "Port" => port)
      rescue Errno::ECONNREFUSED
        return false
      end
      true
    end

    def memcached_connection
      @memcached
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
memcached-manager-1.0.0 lib/extensions/memcached_connection.rb