开发者

Difference between Redis (key/value database) and an associative array?

Redis is a NOSQL key/value database, which reads the entire life within 开发者_运维百科RAM (and thus is quite fast). To me, an array (e.g., in PHP) does the same, as an array is a set of key/value. The main difference of a database is that indexed values will be called individually without reading the entire database.

Now when Redis read the entire database (into RAM), how it is different from an array of key/value?


  • One Redis can serve multiple servers across the network
  • As a consequence of the previous point, it supports authentication
  • A Redis dataset can be persisted to disk
  • Redis can work as a queue with blocking reads
  • Redis supports multiple DBs
  • Redis can automatically expire a key after a certain timeout or at a certain time
  • Redis can provide a list of all requests in real time
  • Redis allows to subscribe to certain events
  • Redis supports replication to another Redis server
  • Redis supports multiple languages, you're not tied to a single one


Also note that memory usage in PHP is very bad for arrays. So if you have a large array you will need a lot of memory. Redis can do it more efficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜