Tag:redis

  • Explanation of springboot2. X integrating redis knowledge points

    Time:2020-11-10

    POM file <! — redis dependency in springboot — > <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> to configure #Redis database index (default is 0) spring.redis.database=0 #Redis server address spring.redis.host=39.96.162.54 #Redis server connection port spring.redis.port=6379 #Redis server connection password (blank by default) spring.redis.password=qweqwe #Connection timeout (MS) spring.redis.timeout=0 Configuration class import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.context.annotation.Bean; import […]

  • How Python uses redis to build distributed locks

    Time:2020-10-31

    This article mainly introduces how Python uses redis to build distributed locks. This article introduces in detail the example code, which has a certain reference learning value for everyone’s study or work. Friends in need can refer to it In the actual application scenario, we may have multiple workers, which may be in one machine […]

  • Golang uses Lua script to implement redis atomic operation

    Time:2020-10-17

    catalog [redis calls Lua Script] (ා redis calls Lua script) [redis + Lua realizes the real-time update of the rating list] (ා redis + Lua realizes the real-time update of the rating list) [Lua Script] (ා Lua script)Example of golang calling redis + LuaOptimization of conversion between byte slice and string Redis calls Lua script […]

  • Use redis to get data and transfer it to JSON to solve the problem of dynamic generic parameter transfer

    Time:2020-10-16

    Scene: There are two roles in the project that require different login permissions. Redis is used as the user login information cache database. Code is a method to obtain the corresponding data according to different user entity types. The user entities are: sessionentity < user1 >, sessionentity < user2 >. JSON uses fastjson. First of […]

  • Redis solves the key garbled problem and cleans up the detailed explanation

    Time:2020-10-15

    Key garbled code problem Since redis uses the jdkserializationredisserializer by default, the key is garbled, as follows: keys ‘*!report:flag:phon*’ 1) “\xac\xed\x00\x05t\x00!report:flag:phone_156464” 2) “\xac\xed\x00\x05t\x00!report:flag:phone_198946” 3) “\xac\xed\x00\x05t\x00!report:flag:phone_183302” Solve key garbled code private RedisTemplate redisTemplate; @Autowired(required = false) public void setRedisTemplate(RedisTemplate redisTemplate) { RedisSerializer stringSerializer = new StringRedisSerializer(); redisTemplate.setKeySerializer(stringSerializer); redisTemplate.setValueSerializer(stringSerializer); redisTemplate.setHashKeySerializer(stringSerializer); redisTemplate.setHashValueSerializer(stringSerializer); this.redisTemplate = redisTemplate; } Clean up […]

  • Record of scan command in redis

    Time:2020-10-14

    1、Originally I thought I was quite familiar with the redis command. Various data models and various operations based on redis. But recently, when I used the command mode of redis scan, I suddenly found that my original understanding of the cursor of redis was very limited. So record the process of stepping on the pit, […]

  • The keys command of redis must not be misused

    Time:2020-10-8

    Kesy command Time complexity: O (n). Suppose that the key name in redis and the length of the given schema are limited, n is the number of keys in the database. The redis keys command is used to find all keys that match a given pattern Although the time complexity of this operation is O […]

  • Explain redis data type in detail

    Time:2020-10-6

    Redis supports five data types: string (string), hash (hash), list (list), set (set) and Zset (sorted set: ordered set). String (string) As like as two peas, string is the most basic type of redis. You can understand it as a type that is exactly the same as Memcached, and a key corresponds to a value. […]

  • Causes and solutions of redis cache penetration

    Time:2020-10-5

    In parallel projects, we must consider a cache penetration. So what is cache penetration? To put it simply, when a large number of requested keys are not in the cache at all, the requests are directly sent to the database without going through the cache layer at all. For example, if a hacker deliberately creates […]

  • Detailed explanation of the principles of four commonly used redis caching strategies

    Time:2020-10-4

    As we all know, one of the simplest and most popular ways to improve system performance is to use caching. We introduce caching, which is equivalent to copying the data. When the system data is updated, it is very important to keep the cache and data source (such as MySQL database) synchronized. Of course, this […]

  • Redis execution performance test

    Time:2020-10-3

    Redis performance test is implemented by executing multiple commands at the same time. grammar The basic commands for redis performance test are as follows: redis-benchmark [option] [option value] Note that the redis command is executed in the internal directory of the client. example The following example performs 10000 requests simultaneously to detect performance: $ redis-benchmark […]

  • Analysis of the implementation process of installing redis in virtual machine Linux

    Time:2020-10-2

    Redis official website website-adress Installation procedure 1. Download redis according to the weget command at the bottom of the official website Then if you’re right, you’ll make a mistake on the make command Since redis is written by C, the running environment of C needs to be installed yum install gcc-c++ Then you may report […]