class Dalli::Server::KSocket
Attributes
options[RW]
server[RW]
Public Class Methods
included(receiver)
click to toggle source
# File lib/dalli/socket.rb, line 110 def self.included(receiver) receiver.send(:attr_accessor, :options, :server) receiver.send(:include, InstanceMethods) end
Public Instance Methods
kgio_wait_readable()
click to toggle source
# File lib/dalli/socket.rb, line 10 def kgio_wait_readable IO.select([self], nil, nil, options[:socket_timeout]) || raise(Timeout::Error, "IO timeout") end
kgio_wait_writable()
click to toggle source
# File lib/dalli/socket.rb, line 14 def kgio_wait_writable IO.select(nil, [self], nil, options[:socket_timeout]) || raise(Timeout::Error, "IO timeout") end
read_available()
click to toggle source
# File lib/dalli/socket.rb, line 29 def read_available value = '' loop do ret = kgio_tryread(8196) case ret when nil raise EOFError, 'end of stream' when :wait_readable break else value << ret end end value end
readfull(count)
click to toggle source
# File lib/dalli/socket.rb, line 20 def readfull(count) value = '' loop do value << kgio_read!(count - value.bytesize) break if value.bytesize == count end value end