Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (25 sloc) 0.514 kB
require 'zlib'
require 'stringio'
module Dalli
class Compressor
def self.compress(data)
Zlib::Deflate.deflate(data)
end
def self.decompress(data)
Zlib::Inflate.inflate(data)
end
end
class GzipCompressor
def self.compress(data)
io = StringIO.new("w")
gz = Zlib::GzipWriter.new(io)
gz.write(data)
gz.close
io.string
end
def self.decompress(data)
io = StringIO.new(data, "rb")
Zlib::GzipReader.new(io).read
end
end
end
Jump to Line
Something went wrong with that request. Please try again.