redis基础一_常用指令

# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
 ./redis-server /path/to/redis.conf

docker启动redis:

 docker run -d -p 6379:6379 -v /home/anmin/Desktop/docker/redis/data:/redis/data -v /home/anmin/Desktop/docker/redis/config:/redis/config redis redis-server /redis/config/redis.conf --appendonly yes

启动 redis 客户端:

切换数据库,redis默认有16个数据库:

DBSIZE:

KEYS:查找所有符合给定模式pattern(正则表达式)的 key 。


 KEY:

   

    


STRING:

     

     

   

  


 LIST

返回存储在 key 的列表里指定范围内的元素。 start 和 end 偏移量都是基于0的下标,即list的第一个元素下标是0(list的表头),第二个元素下标是1,以此类推。

偏移量也可以是负数,表示偏移量是从list尾部开始计数。 例如, -1 表示列表的最后一个元素,-2 是倒数第二个,以此类推。

    

   


SET

      


 HASH: 

    

 


 ZSET:有序集合 

原文地址:https://www.cnblogs.com/ustc-anmin/p/11071047.html