Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Redis usage

Shulou Source: shulou.com Published: 2022-06-03 07:54:03 11月08日 Update

Prepare knowledge

Redis is an open source in-memory data structure repository used for databases, caching, and message queues. Supported data types save strings, hashes, lists, collections. 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.

Instruction use

1) login instruction $redis-cli-h 192.168.58.138-p 6379-a "fengyuzaitu"

2) View the running status of the service: 127.0.0.1purl 6379 > ping

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

Subscription instruction use

1) the Psubscribe command subscribes to one or more channels that match a given pattern. Each pattern uses * as a match, such as it* matches all channels that start with it (it.news, it.blog, it.tweets, and so on). News.* matches all news. The opening channel (news.it news.global.today, etc.), and so on.

Redis 127.0.0.1 6379 > PSUBSCRIBE USER_POSITION_INFO*

2) the Subscribe command is used to subscribe to information for a given channel or channels.

Redis 127.0.0.1 6379 > SUBSCRIBEUSER_POSITION_INFO

Note: topics subscribed to by Psubscribe must have *, which is completely different from Subscribe

Tags: Channels subscriptions instructions data commands multiple beginnings patterns etc. topics information memory characters strings databases data structures messages status knowledge types Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MariaDB Docker MySQL Huawei