lib/memcached/memcached.rb
def big_get(key, marshal=true)
    chunk_header = get(key, true)

    # A valid chunk header should respond to #chunks.
    return marshal ? chunk_header : get(key, marshal) unless chunk_header.respond_to?(:chunks)

    chunks = chunk_header.chunks
    chunk_keys = (0...chunks).map { |i| "#{key}_#{i}" }

    # Use multiget #get - this returns a hash of key/value pairs.
    chunky_hash_browns = get(chunk_keys, false)

    # If any of the chunks are missing, the entire item is considered missing.
    raise Memcached::NotFound if chunky_hash_browns.size != chunks

    # Concat all the chunked values.
    value = chunky_hash_browns.sort.map { |k, v| v }.join
    value = Marshal.load(value) if marshal
    value
  end
# EXPERIMENTAL
#
# Gets a key's value from the server. Accepts a single String key.
#
# Accepts an optional <tt>marshal</tt> argument, which defaults to <tt>true</tt>, like <tt>get</tt>.
EXPERIMENTAL
Gets a key's value from the server. Accepts a single String key.

Accepts an optional marshal argument, which defaults to true, like get.
EXPERIMENTAL Gets a key ' s value from the server . Accepts a single String key . Accepts an optional marshal argument which defaults to true like get .
def big_get(key, marshal=true)
    chunk_header = get(key, true)
    return marshal ? chunk_header : get(key, marshal) unless chunk_header.respond_to?(:chunks)
    chunks = chunk_header.chunks
    chunk_keys = (0...chunks).map { |i| "#{key}_#{i}" }
    chunky_hash_browns = get(chunk_keys, false)
    raise Memcached::NotFound if chunky_hash_browns.size != chunks
    value = chunky_hash_browns.sort.map { |k, v| v }.join
    value = Marshal.load(value) if marshal
    value
  end
def big_get ( key , marshal = true ) chunk_header = get ( key , true ) return marshal ? chunk_header : get ( key , marshal ) unless chunk_header . respond_to? ( :chunks ) chunks = chunk_header . chunks chunk_keys = ( 0 ... chunks ) . map { | i | "#{key}_#{i}" } chunky_hash_browns = get ( chunk_keys , false ) raise Memcached :: NotFound if chunky_hash_browns . size != chunks value = chunky_hash_browns . sort . map { | k , v | v } . join value = Marshal . load ( value ) if marshal value end
EXPERIMENTAL
Gets a key's value from the server.
EXPERIMENTAL Gets a key ' s value from the server .
# A valid chunk header should respond to #chunks. # Use multiget #get - this returns a hash of key/value pairs. # If any of the chunks are missing, the entire item is considered missing. # Concat all the chunked values.
key
marshal