Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does Redis mean?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what Redis refers to. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Redis is a very fast open source non-relational database that stores key mappings for five different types of values. Used as a database, cache and message broker. The following article will introduce Redis. I hope it will be helpful to you.

What is Redis?

Redis is an in-memory key-value database, often referred to as a data structure server. One of the main differences between Redis and other key-value databases is the ability of Redis to store and manipulate advanced data types. These data types are basic data structures (lists, mappings, collections, and sort sets) that most developers are familiar with. Redis's excellent performance, simplicity and atomic operation of data structures help to solve the problems that are difficult to implement or perform poorly when using traditional relational database implementations.

Main features of Redis

Advanced data structures: provide five possible data types for values: strings, lists, collections, hashes, and ordered collections. Provides operations unique to these data types and has a well-documented time complexity (Big O notation).

High performance: because of its memory nature, project maintainers keep complexity to a minimum and an event-based programming model, Redis has excellent performance in read and write operations.

Lightweight without dependencies: written in ANSI C with no external dependencies. Applies to all POSIX environments. Windows is not officially supported, but Microsoft provides an experimental version.

High availability: built-in support for asynchronous, non-blocking, master / slave replication to ensure high availability of data. There is currently a high availability solution called Redis Sentinel that is currently available, but is still considered work in progress.

Redis function:

Here are some of the most important Redis features:

● memory cache: because of its high performance, Redis can easily persist data to disk when the number of read and write operations exceeds the function of traditional database.

● supports publish / subscribe: Redis provides the ability to distribute data using the publish / subscribe messaging paradigm.

● automatic reconnect support

● Lua script

The lifetime of ● key is limited.

● LRU eviction key

● automatic failover

● built-in replication

● data structures support strings, hashes, lists, collections, ordered sets, bitmaps, super logs, geospatial indexes

Redis supports data structures and can store strings, lists, collections, and hashes. It provides interesting features such as built-in replication, LRU eviction, transactions, disk persistence and high availability. It provides automatic failover in a clustered environment; it can be used with most languages.

Example of redis command

Next, I would like to introduce the redis command.

SET (setting key)

127.0.0.1 OK 6379 > SET foo "Hello World" set key

GET (get key)

127.0.0.1 6379 > GET foo "Hello World" / / get the key

DEL (delete key)

127.0.0.1 GET foo "Hello World" / / get the key 127.0.0.1 DEL foo (integer) 1 / / the key has just been deleted 127.0.0.1 > GET foo (nil) / / the self-key is therefore deleted, and the result is zero.

SETEX (set the validity period of the key)

127.0.0.1 6379 > SETEX foo 40 "I said, Hello World!" The OK / / key has been set to expire in 40 seconds

TTL (total time remaining for the key)

127.0.0.1Redis 6379 > TTL foo (integer) 36 / / 36 seconds after timeout, this is the end of sharing about what Redis means. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report