Redis是什么
一种开源(BSD 许可)的内存数据结构存储,用作数据库、缓存、消息代理和流引擎。
在线思考:redis作为消息代理和流引擎的应用场景有哪些???(手动狗头)
注:以下介绍中使用英文而不翻译不是作者懒(😄),而是希望读者能够结合自己的翻译工具和知识背景做出更适合自己理解的翻译结果。
常用的数据结构
- strings
- hashes
- lists
- sets
- sorted sets with range queries
- bitmaps
- hyperloglogs
- geospatial indexes
- streams
在线思考:以上数据结构的应用场景有哪些???(手动狗头)特别是bitmaps、hyperloglogs、geospatial indexes和steams。
高阶知识
- built-in replication
- Lua scripting
- LRU eviction
- transactions
- different levels of on-disk persistence
- provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster
在线思考:上面高阶知识的使用场景???
常用原子化操作
- appending to a string
- incrementing the value in a hash
- pushing an element to a list
- computing set intersection,union and difference
- getting the member with highest ranking in a scored set
内存 vs 持久化
To achieve top performance, Redis works with an in-memory dataset.
Depending on your use case, Redis can persist your data either by periodically dumping the dataset to disk or by appending each command to a disk-based log.
You can also disable persistence if you just need a feature-rich, networked, in-memory cache.
在线思考:持久化方式有哪些?持久化原理?使用场景?使用策略?