cayasso/cacheman-mongo — pull request #2 by Jared314 (2014-06-08 06:14:48+00:00)
Title: Optional Cache Value Compression

MongoDB has a 16MB document size limit, and, currently, does not have built in support for compression. So, I found it useful to gzip large Buffers I stored using cacheman-mongo.

var cache = new Cache({ compression: true }, {});
cache.set('test1', new Buffer("something big"), function (err) {...});

It only compresses Buffers because of the complexity in correctly decompressing and deserializing the variety of data structures and string encodings. (Using the BSON serializer might be a good solution to this problem, but I have not yet explored it.)