return
outputFile.write(chunk)

def compressFileToString(inputFile):
    """
  read the given open file, compress the data and return it as string.
  """
stream = cStringIO.StringIO()
compressor = gzip.GzipFile(fileobj=stream, mode='w')
while True:
    chunk = inputFile.read(8192)
if not chunk:
    compressor.close()
return stream.getvalue()
compressor.write(chunk)
Which is the best way to compress json to store in a memory based store like redis or memcache?