current location:Home > Technical Articles > Database > Redis

  • How to implement scheduled tasks in php redis
    How to implement scheduled tasks in php redis
    How to implement scheduled tasks in phpredis: 1. Modify the content of the configuration file redis.conf to "notify-keyspace-events"Ex""; 2. Restart the redis service; 3. Pass "object(Redis)#1(0){}string (22) "__keyevent@*__:expired" string (22) "__keyevent@0__:expire..." Just implement the scheduled task. PHP+redis implements the scheduled task and modify the configuration file redis.conf; notify-ke
    Redis 4298 2023-05-26 23:57:21
  • How to use lazy deletion Lazy free in Redis
    How to use lazy deletion Lazy free in Redis
    When Lazyfreekey expires using lazy deletion or the DEL delete command is used, Redis will not only remove the object from the global hash table, but also release the memory allocated by the object. When bigkey is encountered, releasing memory will cause the main thread to block. To this end, Redis 4.0 introduced the UNLINK command to put the object memory release operation into the bio background thread for execution. This effectively reduces main thread blocking. Redis6.0 goes a step further and introduces Lazy-free related configurations. When the configuration is enabled, the "release object" operation will be "executed asynchronously" within the key expiration and DEL commands. voiddelCommand(client*c){delGenericC
    Redis 1891 2023-05-26 23:37:04
  • How to build a stand-alone Redis cache service
    How to build a stand-alone Redis cache service
    1. Install gcc[root@localhost~]#yuminstallgcc Loaded plug-in: fastestmirror,langpacksbase|3.6kB00:00:00Loadingmirrorspeedsfromcachedhostfile*base: Resolving dependencies-->Checking transactions--->Software package gcc.x86_64.0.4 .8.5-16.el7 will be upgraded ---> Package gcc.x86_64.0.4.8.5-44.el7 will be updated --> Processing dependency libgomp=4.
    Redis 1218 2023-05-26 23:26:05
  • What will happen if Redis memory is too large?
    What will happen if Redis memory is too large?
    1. When the main database is down, let’s first look at the disaster recovery process when the main database is down: As shown below, when the main database is down, our most common disaster recovery strategy is “cutting off the master”. Specifically, it selects a slave library from the remaining slave libraries of the cluster and upgrades it to the master library. After the slave library is upgraded to the master library, the remaining slave libraries are mounted under it to become its slave library, and finally the entire master-slave database is restored. Cluster structure. The above is a complete disaster recovery process, and the most costly process is the remounting of the slave library, not the switching of the main library. This is because redis cannot continue to synchronize data from the new main database after the main database changes based on synchronization points like mysql and mongodb. In the redis cluster, once the slave database changes master, Redis's approach is to clear the slave database that replaced the master database and then complete the synchronization from the new master database.
    Redis 1582 2023-05-26 23:19:04
  • How to solve common latency problems in Redis
    How to solve common latency problems in Redis
    Using highly complex commands If you find that the access delay suddenly increases when using Redis, how can you troubleshoot? First of all, the first step is to check the slow log of Redis. Redis provides a statistics function for slow log commands. Through the following settings, we can check which commands have a large delay during execution. First set the slow log threshold of Redis. Only commands that exceed the threshold will be recorded. The unit here is microseconds. For example, set the slow log threshold to 5 milliseconds and set only the latest 1000 slow log records to be retained: # Command execution exceeds 5 Millisecond record slow log CONFIGSETslowlog-log-slower-than5000#Only keep the latest 1000 slow logs
    Redis 1764 2023-05-26 22:50:09
  • How to integrate SpringBoot with Redis
    How to integrate SpringBoot with Redis
    1. Introduce dependency org.springframework.bootspring-boot-starter-data-redis2.4.4 2. Backend code: spring.redis.database=0spring.redis.host=192.168.1.xxxspring.redis.port=8099spring.redis. jedis.pool.max-active=8spring.redis.jedis.pool.max-wait=-1msspring.redis.jedis.pool.max-i
    Redis 693 2023-05-26 22:31:30
  • What is the underlying principle of redis
    What is the underlying principle of redis
    Redis core object There is a "core object" in Redis called redisObject, which is used to represent all keys and values. The redisObject structure is used to represent the five data types of String, Hash, List, Set, and ZSet. The source code of redisObject is in redis.h, written in C language. If you are interested, you can check it out by yourself. I have drawn a picture here about redisObject, which shows the structure of redisObject as follows: In redisObject, "type indicates which type it belongs to" Data type, encoding represents the storage method of the data", that is, the underlying
    Redis 1114 2023-05-26 22:21:13
  • How to use Redis in Golang distributed applications
    How to use Redis in Golang distributed applications
    Text Redis is a high-performance in-memory database that is often used in distributed systems. In addition to being a distributed cache or a simple in-memory database, it also has some special application scenarios. This article combines Golang to write the corresponding middleware. In a distributed lock stand-alone system, we can use sync.Mutex to protect critical resources. There is also such a demand in a distributed system. When multiple hosts seize the same resource, a corresponding "distributed lock" needs to be added. In Redis, we can use the setnx command to set the corresponding value if the key does not exist. If the setting is successful, the lock will be successful. If the key does not exist and return failure, the lock release can be achieved through del. The main logic is as follows: typeRedisLoc
    Redis 846 2023-05-26 22:07:36
  • How to install redis extension in docker php container
    How to install redis extension in docker php container
    1. Download the redis extension package redis extension download address https://pecl.php.net/package/redis 2. Unzip the extension package $tar-zxvfredis-5.3.4.tgz Unzip the redis extension package 3. Copy the extension package to the PHP container 3.1 View the container dockerps-a3.2 Copy the extension package to the PHP container dockercpdockercp/docker/tool/redis-5.3.4php:/usr/src/php/ext/redis#/docker/tool/redis-5.3.4 The address of the unzipped package #php:container
    Redis 2220 2023-05-26 22:01:04
  • How to use redis to implement countdown tasks
    How to use redis to implement countdown tasks
    An example is as follows: importredisimporttimedefevent_handler(msg):'''After listening to any key expiration, the message obtained is as follows msg={'type':'pmessage',#Return value type 'pattern':'__keyevent@2__:expired',# Source 'channel'
    Redis 1190 2023-05-26 21:58:04
  • What are the various data types and cluster-related knowledge in redis?
    What are the various data types and cluster-related knowledge in redis?
    Various data types The string type is simple and convenient, and supports space pre-allocation, that is, more space will be allocated each time, so that if the string becomes longer next time, there is no need to apply for additional space. Of course, the premise is that the remaining space is enough. . [Related recommendation: Redis video tutorial] The List type can implement a simple message queue, but please note that there may be message loss, and it does not support ACK mode. The Hash table is a bit like a relational database, but when the hash table becomes larger and larger, please be careful to avoid using statements such as hgetall, because requesting a large amount of data will cause redis to block, so the brothers behind will have to wait. The set collection type can help you do some statistics, for example, if you want statistics
    Redis 1001 2023-05-26 21:40:54
  • How to open and close redis in Linux
    How to open and close redis in Linux
    Redis is a high-performance key-value database. The emergence of redis has largely compensated for the shortcomings of keyvalue storage such as memcached, and can play a very good supplementary role to relational databases in some situations. 1. Start: redis-server (redis-serverredis.conf) 2. Log in: redis-cli (redis-cli-p6379) 3. Close: redis-clishutdown
    Redis 1227 2023-05-26 21:16:04
  • How to start redis under linux system
    How to start redis under linux system
    1. Start directly into the redis root directory and execute the command: #Add the '&' sign to make redis run as a background program nohupredis-server& 2. Start by specifying the configuration file to start the specified configuration file for the redis service, for example, configure it as /etc/ redis/6379.conf Enter the redis root directory and enter the command: ./redis-server/etc/redis/6379.conf #If the port is changed, you also need to specify the port when using the redis-cli client to connect, for example: redis- cli-p63803
    Redis 22186 2023-05-26 21:00:52
  • How to set redis password in Linux system
    How to set redis password in Linux system
    After installing redis under the Linux system, no password is required by default, and you need to set the password yourself. First open the configuration file vimredis.conf, search for /requirepass in the command line state, then add requirepass123 in the insert mode, close redis/usr/local/redis/bin/redis-clishutdown, start redis/usr/local/redis/bin/redis-server/ usr/local/redis/etc/redis.conf Enter the client to view /usr/local/redis/bin/redis
    Redis 3238 2023-05-26 21:00:46
  • How to use redis publish and subscribe method to implement a simple messaging system
    How to use redis publish and subscribe method to implement a simple messaging system
    I. Basic use 1. Configuration We use SpringBoot2.2.1.RELEASE to build the project environment and directly add the redis dependency org.springframework.bootspring-boot-starter-data-redis in pom.xml. If our redis is the default configuration, then You don’t need to add any additional configuration; you can also configure it directly in the application.yml configuration, as follows spring:redis:host:127.0.0.1port:6379password:2. Use the publish/subscribe posture of redis, mainly using the two commands pu
    Redis 1314 2023-05-26 20:52:31

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