class Dalli::Protocol::Binary::ResponseHeader
Class that encapsulates data parsed from a memcached response header.
Constants
- FMT
- NOT_STORED_STATUSES
- SIZE
Attributes
body_len[R]
cas[R]
data_type[R]
extra_len[R]
key_len[R]
opaque[R]
status[R]
Public Class Methods
new(buf)
click to toggle source
# File lib/dalli/protocol/binary/response_header.rb, line 14 def initialize(buf) raise ArgumentError, "Response buffer must be at least #{SIZE} bytes" unless buf.bytesize >= SIZE @key_len, @extra_len, @data_type, @status, @body_len, @opaque, @cas = buf.unpack(FMT) end
Public Instance Methods
not_found?()
click to toggle source
# File lib/dalli/protocol/binary/response_header.rb, line 24 def not_found? status == 1 end
not_stored?()
click to toggle source
# File lib/dalli/protocol/binary/response_header.rb, line 29 def not_stored? NOT_STORED_STATUSES.include?(status) end
ok?()
click to toggle source
# File lib/dalli/protocol/binary/response_header.rb, line 20 def ok? status.zero? end