2008-05-18 06:22:34 +02:00
|
|
|
module ActiveSupport
|
|
|
|
module Cache
|
|
|
|
class CompressedMemCacheStore < MemCacheStore
|
2008-09-07 07:54:05 +02:00
|
|
|
def read(name, options = nil)
|
|
|
|
if value = super(name, (options || {}).merge(:raw => true))
|
2008-05-18 06:22:34 +02:00
|
|
|
Marshal.load(ActiveSupport::Gzip.decompress(value))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-09-07 07:54:05 +02:00
|
|
|
def write(name, value, options = nil)
|
|
|
|
super(name, ActiveSupport::Gzip.compress(Marshal.dump(value)), (options || {}).merge(:raw => true))
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|