current location:Home > Technical Articles > Database > Redis

  • Redis transaction instance analysis
    Redis transaction instance analysis
    The use of Redis in Redis implements transaction functions through multi, exec, discard, and watch. multi: start transaction exec: commit the transaction and execute discard: cancel the transaction watch: monitor any number of keys before the transaction starts>multiOK>setbookName"Redis"QUEUED>getbookNameQUEUED>saddtag"Redis""NewBook"QUEUED>smemberstagQUEUED>e
    Redis 1545 2023-05-26 11:25:55
  • How to exclude the automatic configuration of redis in springboot
    How to exclude the automatic configuration of redis in springboot
    Springboot excludes the automatic configuration of redis because it needs to configure a redis link, so it excludes the configuration that comes with the system, namely RedisAutoConfiguration.class and RedisRepositoriesAutoConfiguration.class. It should be noted that RedisRepositoriesAutoConfiguration has a bean whose bean name is "redisTemplate". If there are dependencies, you need to exclude @SpringBootApplication(exclude={RedisAu
    Redis 2474 2023-05-26 11:16:05
  • Example analysis of AOF persistence in Redis
    Example analysis of AOF persistence in Redis
    1. Introduction to AOF One of the persistence methods of Redis, RDB, records the status of the database by saving key-value pairs in the database. Another persistence method, AOF, records the database status by saving the write commands executed by the Redis server. For example, for the following commands: The RDB persistence method is to save the three key-value pairs of str1, str2, and str3 into the RDB file, while the AOF persistence is to save the executed set, sadd, and lpush commands into the AOF file. . 2. AOF configuration Under APPENDONLYMODE in the redis.conf configuration file: ①. appendonly: The default value is n
    Redis 1446 2023-05-26 11:08:52
  • How Redis uses different memory allocators to compare fragmentation rates
    How Redis uses different memory allocators to compare fragmentation rates
    In the zmalloc.c source code of Redis, we can see the following code: /*Explicitlyoverridemalloc/freeetcwhenusingtcmalloc.*/ #ifdefined(USE_TCMALLOC) #definemalloc(size)tc_malloc(size) #definecalloc(count,size)tc_calloc(count,size ) #definerealloc(ptr,size)tc_realloc(ptr,size) #de
    Redis 1713 2023-05-26 10:58:21
  • How Nginx uses Lua+Redis to dynamically ban IPs
    How Nginx uses Lua+Redis to dynamically ban IPs
    1. Background In our daily maintenance of the website, we often encounter such a requirement. In order to block certain crawlers or malicious users from making requests to the server, we need to establish a dynamic IP blacklist. For IPs in the blacklist, services will be denied. 2. There are many ways to implement the IP blacklist function in the architecture: 1. At the operating system level, configure iptables to reject network requests for specified IPs; 2. At the webserver level, configure the IP blacklist through the deny option of nginx itself or the Lua plug-in; 3. At the application level, check whether the client IP is in the blacklist before requesting the service. In order to facilitate management and sharing, we implement IP through the architecture of nginx+lua+redis
    Redis 1911 2023-05-26 10:50:54
  • How to use centralized cache Redis in Spring Boot
    How to use centralized cache Redis in Spring Boot
    Try the definition of User entity @Entity@Data@NoArgsConstructorpublicclassUserimplementsSerializable{@Id@GeneratedValueprivateLongid;privateStringname;privateIntegerage;publicUser(Stringname,Integerage){this.name=name;this.age=age;}}Data access implementation of User entity (covers cache annotations) @CacheConfig(ca
    Redis 1514 2023-05-26 10:49:05
  • How to add redis to php's Yii framework
    How to add redis to php's Yii framework
    1. Download the Rediscache plug-in and extract the plug-in to helloyii/app/protected/extensions: the location of the plug-in file after deployment should be: helloyii/app/protected/extensions/redis/CredisCache.php. Add it to yii's web.php configuration file yii-redis component 2. Install the redis extension of yii2 cd/www/html/basicphpcomposer.pharrequire--prefer-distyiisoft/yii2-redis3. In the w of yii
    Redis 1505 2023-05-26 10:31:06
  • Why is Redis so fast using single thread?
    Why is Redis so fast using single thread?
    Why does Redis use single thread? Under normal circumstances, after using multi-threading, if there is no good system design, the overhead of multi-threading is actually as shown in the figure on the right (note the ordinate). When you first increase the number of threads, the system throughput rate will increase. When you further increase the number of threads, the system throughput rate will increase slowly or even decrease. The key bottleneck is that there are usually shared resources in the system that are accessed by multiple threads at the same time. In order to ensure the correctness of the shared resources, additional mechanisms are needed to ensure thread safety, such as locking, which will bring additional overhead. For example, take the most commonly used List type as an example. Assume that Redis adopts a multi-thread design and there are two threads A and B doing LPUSH and LPU on the List respectively.
    Redis 1493 2023-05-26 09:56:06
  • How to build a redis three-master and three-slave cluster with docker
    How to build a redis three-master and three-slave cluster with docker
    1. Prepare the redis image and container 1.1. Download redis6.0.8dockerpullredis:6.0.81.2 Prepare 6 server configuration files #redis configuration is placed at the end of the article mkdir-p/usr/local/repository/redis/redis-node-1#Configuration reference At the end of the article vim/usr/local/repository/redis/redis-node-1/redis.confcd/usr/local/repository/redis#Copy the other 5 copies in sequence cp-rredis-node-1/./redi
    Redis 1100 2023-05-26 09:47:58
  • How SpringBoot implements redis cache menu list
    How SpringBoot implements redis cache menu list
    Because the system's menu list is not easily changed, there is no need to query the database every time it is requested. Therefore, when the menu list is requested for the first time based on the user ID, the menu list data can be cached in redis Here, when requesting the menu list for the second time, you can directly obtain the data from the redis cache, thereby reducing operations on the database and improving performance! First, we need to download redis locally, then open the src directory of redis in the cmd terminal, and then run redis-server to start the redis local service (mac). After opening the redis service, we must configure the relevant redis in the project Code, first in pom.xml
    Redis 1600 2023-05-26 09:43:00
  • What are redis serialization and various serialization situations?
    What are redis serialization and various serialization situations?
    Serialization basically uses jdk serialization by default, which will cause string escaping. In actual development, when we want to store objects in redis, we must serialize them. Of course, if we convert the object into a json string, what is stored is equivalent to a string. Not serializing does not affect normal operation. However, we usually have to serialize the objects we create. If we don't serialize, we may use json to convert the stored objects in actual development, and we don't want to use jdk serialization yet (the default is jdk serialization). At this point we need to use the configuration class. We create a redisTemplate object to overwrite the original redistemplate object in the bean container. Serialization
    Redis 1320 2023-05-26 09:40:18
  • Application examples of Redis in recommendation systems
    Application examples of Redis in recommendation systems
    Application examples of Redis in recommendation systems With the development of the Internet and the explosive growth of information, information overload has become a major problem affecting people's access to information. Therefore, the recommendation system emerged as the times require. It can predict user behavior through algorithms and provide personalized recommendation services, which greatly improves user experience and product profits. The implementation of the recommendation system requires a large amount of data storage, processing and calculation, and Redis is an excellent solution. Redis is a high-performance NoSQL database,
    Redis 1727 2023-05-12 11:21:06
  • Redis methods and application examples for implementing distributed management locks
    Redis methods and application examples for implementing distributed management locks
    Redis' method and application examples for implementing distributed management locks. With the rapid development of network applications, distributed systems have become an important part of modern applications. However, in a distributed system, due to the operations involving multiple nodes, competition and deadlock problems are prone to occur when resources are shared between processes. In order to solve these problems, distributed management locks came into being. Distributed lock refers to a mechanism for controlling access to shared resources in a distributed system. It can ensure that only one process of multiple processes can operate on shared resources at the same time.
    Redis 834 2023-05-12 08:27:05
  • Application examples of Redis in machine learning and artificial intelligence
    Application examples of Redis in machine learning and artificial intelligence
    In recent years, machine learning and artificial intelligence technologies have been widely used in various fields. Among them, data processing is the core part in the fields of machine learning and artificial intelligence. As a high-performance in-memory database, Redis is gradually becoming one of the data processing frameworks in the fields of machine learning and artificial intelligence. This article will analyze the application examples of Redis in machine learning and artificial intelligence. 1. Redis and machine learning 1. Optimizing machine learning algorithms based on Redis caching mechanism. During the execution of machine learning algorithms, it is often necessary to
    Redis 1287 2023-05-11 23:31:36
  • Analysis and application of Redis network IO model
    Analysis and application of Redis network IO model
    Redis is an open source, high-performance key-value storage system that is widely used in big data, architecture design and other fields. Its efficient network IO model is an important foundation for its rapid response to requests. This article will introduce the network IO model of Redis and its implementation principles, and discuss its optimization methods in practical applications. 1. Redis network IO model Redis network IO model chooses a combination of single thread and multiplexing. The basic process is as follows: Redis first creates a listening sock through the socket function
    Redis 1100 2023-05-11 20:51:08

Tool Recommendations

jQuery enterprise message form contact code

jQuery enterprise message form contact code is a simple and practical enterprise message form and contact us introduction page code.
form button
2024-02-29

HTML5 MP3 music box playback effects

HTML5 MP3 music box playback special effect is an mp3 music player based on HTML5 css3 to create cute music box emoticons and click the switch button.

HTML5 cool particle animation navigation menu special effects

HTML5 cool particle animation navigation menu special effect is a special effect that changes color when the navigation menu is hovered by the mouse.
Menu navigation
2024-02-29

jQuery visual form drag and drop editing code

jQuery visual form drag and drop editing code is a visual form based on jQuery and bootstrap framework.
form button
2024-02-29

Organic fruit and vegetable supplier web template Bootstrap5

An organic fruit and vegetable supplier web template-Bootstrap5
Bootstrap template
2023-02-03

Bootstrap3 multifunctional data information background management responsive web page template-Novus

Bootstrap3 multifunctional data information background management responsive web page template-Novus
backend template
2023-02-02

Real estate resource service platform web page template Bootstrap5

Real estate resource service platform web page template Bootstrap5
Bootstrap template
2023-02-02

Simple resume information web template Bootstrap4

Simple resume information web template Bootstrap4
Bootstrap template
2023-02-02

Cute summer elements vector material (EPS PNG)

This is a cute summer element vector material, including the sun, sun hat, coconut tree, bikini, airplane, watermelon, ice cream, ice cream, cold drink, swimming ring, flip-flops, pineapple, conch, shell, starfish, crab, Lemons, sunscreen, sunglasses, etc., the materials are provided in EPS and PNG formats, including JPG previews.
PNG material
2024-05-09

Four red 2023 graduation badges vector material (AI EPS PNG)

This is a red 2023 graduation badge vector material, four in total, available in AI, EPS and PNG formats, including JPG preview.
PNG material
2024-02-29

Singing bird and cart filled with flowers design spring banner vector material (AI EPS)

This is a spring banner vector material designed with singing birds and a cart full of flowers. It is available in AI and EPS formats, including JPG preview.
banner picture
2024-02-29

Golden graduation cap vector material (EPS PNG)

This is a golden graduation cap vector material, available in EPS and PNG formats, including JPG preview.
PNG material
2024-02-27

Home Decor Cleaning and Repair Service Company Website Template

Home Decoration Cleaning and Maintenance Service Company Website Template is a website template download suitable for promotional websites that provide home decoration, cleaning, maintenance and other service organizations. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-05-09

Fresh color personal resume guide page template

Fresh color matching personal job application resume guide page template is a personal job search resume work display guide page web template download suitable for fresh color matching style. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-29

Designer Creative Job Resume Web Template

Designer Creative Job Resume Web Template is a downloadable web template for personal job resume display suitable for various designer positions. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28

Modern engineering construction company website template

The modern engineering and construction company website template is a downloadable website template suitable for promotion of the engineering and construction service industry. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28