Friday, 5 May 2017

Storing string data with compressed (buffer) data together on Redis

Is there any chance to store Buffer data with a string data together on Redis.

Pseudo code:

// Data compression
var user = { name: "Xyz" }
var userString = JSON.stringify(user)
var userBuffer = new Buffer(userString, "utf8")
var compressed = zlib.gzip(userBuffer)
// Adding data onto Redis
var data = { id: 1, compressed: compressed }
var dataString = JSON.stringify(data)
redis.set("test", dataString)

Although it seems impossible I wanna ask.

Is there any chance to store compressed data with string together?



via efkan

No comments:

Post a Comment