vjjj vjjj - 11 months ago 83
Javascript Question

Redis - persist individual hash

is it possible to persist individual hash in Redis. Something along the lines of -

redis.bgsave(obj, function(err, res){ .... });

My Redis contains a lot of data, all of which need not be persisted. I dont want to use up the RAM and CPU to create a copy of 5GB of data, when all I want is to persist only a few KBs.


Answer Source

No, that's impossible - Redis' persistence, when used, is for the entire instance (i.e. all shared/numbered databases and all keys in them).

Because Redis' overhead is just a couple megabytes, what you should do is spin up two different Redis instances (possibly on the same server), with each of these using a persistence policy suitable to your requirements.