初识REDIS(redis开发与运维)

  1. redis支持的数据结构

    string list set zset hash Bitmaps Hyperloglog GEO

  2. redis的特点
    • 速度快
    • 基于键值对
    • 丰富的功能
    • 简单稳定
    • 客户端语言多
    • 持久化
    • 主从复制
    • 高可用和分布式
  3. redis的使用场景
    1. 缓存
    2. 排行榜
    3. 计数器
    4. 社交网络
    5. 消息队列系统
  4. redis的安装
brew install redis
  1. redis后台启动
./redis-server ../redis.conf --daemonize yes
 /usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf
  1. redis停止服务
redis-cli shutdown
  1. redis数据结构
    1. 字符串内部编码 int embstr raw
      1. 应用场景:缓存 计数 共享session 限速
    2. 哈希内部编码 ziplist hashtable
    3. 列表内部编码 ziplist linkedlist
      1. 消息队列 文章列表
    4. 集合内部编码 hashtable intset
      1. 标签
    5. 有序集合内部编码 ziplist skiplist
      1. 排行榜 社交
  2. 全量遍历键
    1. keys pattern
    2. 删除以video字符串开头的键 redis-cli keys video* | xargs redis-cli del
    3. 渐进式删除 scan cursor match video* count 1000

results matching ""

    No results matching ""