class Siberite::Client::Unmarshal

Public Instance Methods

get(key, opts = {}) click to toggle source
# File lib/siberite/client/unmarshal.rb, line 4
def get(key, opts = {})
  response = client.get(key, opts.merge(:raw => true))
  return response if opts[:raw]

  if is_marshaled?(response)
    Marshal.load(response)
  else
    response
  end
end
is_marshaled?(object) click to toggle source
# File lib/siberite/client/unmarshal.rb, line 16
def is_marshaled?(object)
  o = object.to_s
  o.getbyte(0) == Marshal::MAJOR_VERSION && o.getbyte(1) == Marshal::MINOR_VERSION
rescue Exception
  false
end