温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Redis 使用

发布时间:2020-04-16 15:30:22 来源:网络 阅读:416 作者:fengyuzaitu 栏目:软件技术

准备知识

            Redis是一款开源的内存数据结构存储库,被用于数据库,缓存,以及消息队列。支持的数据类型保存字符串,哈希,列表,集合。Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.



指令使用

            1)登陆指令 $ redis-cli -h 192.168.58.138 -p 6379 -a "fengyuzaitu"

            2)查看服务运行状态  127.0.0.1:6379> ping

            3)(error) NOAUTH Authentication required.      127.0.0.1:6379> auth 'fengyuzaitu'


订阅指令使用

            1)Psubscribe 命令订阅一个或多个符合给定模式的频道。每个模式以 * 作为匹配符,比如 it* 匹配所有以 it 开头的频道( it.news 、 it.blog 、 it.tweets 等等)。 news.* 匹配所有以 news. 开头的频道( news.it news.global.today 等等),诸如此类。

redis 127.0.0.1:6379> PSUBSCRIBE USER_POSITION_INFO*


            2)Subscribe 命令用于订阅给定的一个或多个频道的信息。。

redis 127.0.0.1:6379> SUBSCRIBEUSER_POSITION_INFO


注意:Psubscribe订阅的主题必须带*,这个跟Subscribe完全不一样




向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI