Question

From what I'm seeing in the docs, it appears that Redis only lets you persist all keys, or don't persist at all (to disk).

What I'm trying to do is to only persist keys that don't have a TTL. That is, if I

setex some_key 60 "some data"

// or

set some_key "some data"
expire some_key 60

then don't persist those keys to disk -- ever!

In case this is not possible, I guess the next best solution is to use Memcached for those values, and Redis for what I'd like persisted, but it'd sure be nice if I don't have to go that far..

Was it helpful?

Solution

AFAIK What you are telling is correct it can either persist on can not persist. However, in this scenario Instead of using Memcache I would run two instance of redis one which can persist the keys and one with no persistence. As Creating the redis instance is easy.

Also, In future if there is a situation where you need few keys to be persist you can make the changes easily at application level if you use redis instead of Memcache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top