Daily Backend Interview 5 Questions Day 5

1. What are the commonly used data types of Redis, and briefly talk about the characteristics of common data types

1. String string

The most basic data storage type, ordinary string

SET key value

2. hash hash

Similar to the structure of HashMap in Java

HSET key field value

3. list list

Sort according to insertion order, operate on the left or right, and there can be repeated elements, similar to LinkedList in Java

LPUSH key value1 [value2]

4. Collection set

Unordered collection, no duplicate elements, similar to HashSet in Java

SADD key member1 [member2]

5. Ordered set sorted set/zset

Each element in the collection is associated with a score (score), sorted in ascending order according to the score, and there are no duplicate elements

ZADD key score1 member1 [score2 member2]

Second, the execution order of Mysql query statements?

(8) Select
(9) distinct field name 1, field name 2,
(6) [fun (field name)]  
(1) from table 1
(3) <join type> join table 2 
(2) on <join condition> 
(4) where <where condition> 
(5) group by <field> 
(7) having <having condition> 
(10) order by <sort field> 
(11) limit <start offset, number of rows>

3. In Spring, the main steps to realize the IOC container

1. Configure the package scanning path in the configuration file

2. Recursive package scanning to obtain .class files

3. Use Java reflection to determine the classes that need to be handed over to IOC management

4. Dependency injection on the classes that need to be injected

4. How are transactions implemented in Spring?

Achieved through aop.

1. Preparation: analyze the attributes on the method, and judge whether to start a new transaction

2. If it is enabled: get the database connection, turn off the auto-commit function, and start the transaction

3. Execute specific sql logic operations

4. Rollback on failure

5. Submit if successful

6. Clear relevant transaction information after completion

Five, Integer variable why 100 == 100 is true, and 1000 == 1000 is false

Integer internally caches the numbers between -128~127, and the Integers in this range all point to the same address. And == compares addresses, so 100 is equal;

This mode of caching is called Flyweight mode;

1000 is not equal, because the Flyweight mode is not done, so the addresses are different, so they are not equal.

Guess you like

Origin blog.csdn.net/m0_46948660/article/details/132209778