old_contents: #!/usr/bin/env python
  
  import sys
  import argparse
  import client_wrap
  
  def parse_args():
      parser = argparse.ArgumentParser()
      parser.add_argument("-t", "--type", help="type of the cached data", default="double")
      parser.add_argument("-c", "--connection", help="connection string", default="ipc:///var/run/zero-cache/0")
      parser.add_argument("-w", "--column", help="number of columns", type=int, default=1)
      parser.add_argument("-l", "--log", help="log file name", default="")
      args = parser.parse_args()
  
  def get_keys(client):
      key_str = client.GetKeys()
      keys = key_str.split (';')
      del keys[-1]
  
      if len(keys) == 0:
          sys.exit()
  
      return keys
  
  def print_keys(client, keys):
      for key in keys:
          value = client.ReadLong(key)
          print "%s = %d" % (key, value)
  
  def main():
      parse_args()
      client = client_wrap.ClientWrap("get_test.log", "ipc:///var/run/zero-cache/0", 0)
      keys = get_keys(client)
      print_keys(client, keys)
  
  if __name__ == "__main__":
      main()
  
new_contents: #!/usr/bin/env python
  
  import sys
  import argparse
  import client_wrap
  
  def parse_args():
      parser = argparse.ArgumentParser()
      parser.add_argument("-t", "--type", help="type of the cached data", default="double")
      parser.add_argument("-c", "--connection", help="connection string", default="ipc:///var/run/zero-cache/0")
      parser.add_argument("-w", "--column", help="number of columns", type=int, default=1)
      parser.add_argument("-l", "--log", help="log file name", default="")
      global ARGS
      ARGS = parser.parse_args()
  
  def get_keys(client):
      key_str = client.GetKeys()
      keys = key_str.split (';')
      del keys[-1]
  
      if len(keys) == 0:
          sys.exit()
  
      return keys
  
  def read_value(client, key):
      if ARGS.type == "double":
          return client.ReadDouble(key)
  
      if ARGS.type == "long":
          return client.ReadLong(key)
  
      if ARGS.type == "string":
          return client.ReadString(key)
  
  def print_value(key, value):
      if ARGS.type == "double":
          print "%s = %f" % (key, value)
  
      if ARGS.type == "long":
          print "%s = %d" % (key, value)
  
      if ARGS.type == "string":
          print "%s = %s" % (key, value)
  
  def print_keys(client, keys):
      for key in keys:
          value = read_value(client, key)
          print_value(key, value)
  
  def main():
      parse_args()
      client = client_wrap.ClientWrap("get_test.log", "ipc:///var/run/zero-cache/0", 0)
      keys = get_keys(client)
      print_keys(client, keys)
  
  if __name__ == "__main__":
      main()
  
subject: Implement the type specific values output