NoSQL refers to non-relational database
Features: 1. Handling ultra-large amounts of data
2. Run on a cheap PC server cluster
3. Shatter the bottleneck of performance
Redis is a high-performance Key-value database that stores value types including string strings, list lists, set (collections), Zset (ordered collections). The data is cached in memory, or it can periodically write updated data to disk, or write the modified operation to an appended record file
Redis Use Cases
1. Redis Application
2. Application direct access to Redis, only access to MySQL if Redis access fails
Redis Specific usage scenarios
1. Take the latest n data
2. Leaderboard application, go to TOPN operation
3. Applications that need to set the expiration time accurately
4. Counter Application
5.unique operation gets all row weight values for a certain period of time
6. Real-time system, anti-spam system
7.pub/sub build unique publish and subscribe for real-time messaging systems
8. Build a queue system
9. Caching
The default connection port for Redis server is 6379
The default connection port for MySQL server is 3306
String type
Set setting key corresponds to a value of type string
Setnx NX is the meaning of not exit. Returns 0 if key already exists
Setex sets the value of the key to be of type string, and specifies the validity period for this key value
SetRange Setting the substring of the value of the specified key SetRange name 6 126.com replace [email protected] with [email protected]
Mset setting the value of multiple keys at once successfully returns OK failure returns 0 indicates that any value is not set
Get gets the string value corresponding to key
Getset sets the value of key and returns the old value
Non-relational database Redis learning (1)