Kit Ho
Kit Ho

Reputation: 26998

Redis concept: In memory or DB?

Based on the http://redis.io/topics/faq

Redis is an in-memory but persistent on disk database.

So may I know redis save key/value in memory or in disk? or both?

When writing value in Redis, it write into memory and disk at the same time?

Thanks for the concept.

Upvotes: 3

Views: 1382

Answers (2)

Daniel Williams
Daniel Williams

Reputation: 8885

Redis will atomically snapshot its memory state to disk if so configured. See this part of the docs for more info:

http://redis.io/topics/persistence

So you can have different levels of durability. For the most part, when you get a key, it is out of memory and when you set a key it is also in memory. The data is written to disk independently of read/write operations.

Upvotes: 2

Haleemur Ali
Haleemur Ali

Reputation: 28313

depending on how you configure it, redis can periodically back up the existing state to disk, but otherwise, everything is in memory.

Upvotes: 7

Related Questions