module Sinatra::MemcachedCommand

Public Instance Methods

memcached_command(options) click to toggle source
# File lib/extensions/memcached_command.rb, line 3
def memcached_command options
  host = options[:host]
  port = options[:port]
  command = options[:command]

  memcached_connection = Net::Telnet::new("Host" => host, "Port" => port, "Timeout" => 3)
  memcached_connection.cmd("String" => command, "Match" => /^END/) do |response|
    return {response: response.inspect}
  end
end