strings_intro
STRINGS Intro
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
key-value
STRINGS is a one-to-one key-value relationship.
Lists, Sets, Sorted Sets, and Hashes are one-to-many.
Lists, Sets, Sorted Sets, and Hashes are one-to-many.
Key/Value Data type: Binary-safe strings
Binary-safe strings may contain letters, digits, CJK characters, images, and so on.
That applies not only to the value but also to the key.
That applies not only to the value but also to the key.
key/value maximum length: 512 megabytes
The maximum length of both key and value is 512MB.
key design
- Keep keys reasonably sized.
Readable: "user_1000_email"
Memory-saving: "u1000e" - Use a separator between words in a key.
For example, '_' makes keys easier to read.
If you plan to use SQL (SELECT) on Enterprise, '_' is recommended over other separators.
Command summary
- SET: SET, SETNX, SETEX, SETPEX, MSET, MSETNX, APPEND, SETRANGE
- GET: GET, MGET, GETRANGE, STRLEN
- INCR: INCR, DECR, INCRBY, DECRBY, INCRBYFLOAT
| Commands | Version | Syntax | Description |
|---|---|---|---|
| DECR | 1.0.0 | key | Decrement by 1. New keys are set to -1. |
| DECRBY | 1.0.0 | key decrement | Decrement by decrement. New keys are set to -decrement. |
| DEL | 1.0.0 | key [key ...] | Delete data |
| GET | 1.0.0 | key | Get the value |
| GETSET | 1.0.0 | key value | Get the old value and set a new one |
| INCR | 1.0.0 | key | Increment by 1. New keys are set to 1. |
| INCRBY | 1.0.0 | key increment | Increment by increment. New keys are set to increment. |
| MGET | 1.0.0 | key [key ...] | Get multiple values at once |
| SET | 1.0.0 | key value [EX seconds] [PX milliseconds] [NX|XX] | Set a value. Overwrites an existing key. |
| SETNX | 1.0.0 | key value | Set only if the key does not exist |
| MSET | 1.0.1 | key value [key value ...] | Set multiple values at once |
| MSETNX | 1.0.1 | key value [key value ...] | Set multiple values only if none of the keys exist |
| APPEND | 2.0.0 | key value | Append data. Creates the key if it is missing |
| SETEX | 2.0.0 | key seconds value | Set a value that expires after seconds |
| SETRANGE | 2.2.0 | key offset value | Overwrite from the given offset |
| STRLEN | 2.2.0 | key | Return the byte length of the value |
| GETRANGE | 2.4.0 | key start end | Get a substring of the value |
| INCRBYFLOAT | 2.6.0 | key increment | Increment by a float. New keys are set to increment. |
| PSETEX | 2.6.0 | key milliseconds value | Set a value that expires after milliseconds |
| STRALGO | 6.0.0 | STRALGO LCS | Measure how similar two strings are |
| GETEX | 6.2.0 | key [EX seconds] | Get a value and set expire |
| GETDEL | 6.2.0 | key | Get a value and delete it |
Total : 22
STRINGS command overview
Redis Internal: STRING data structure
-
STRING data structure
Internally STRING is split into integer and string encodings. Integers are shared or independent. Strings are EMBSTR (allocated together) or RAW (allocated separately). This page covers the internal STRING data structure.
PDF manual
| << Commands | STRINGS | SET >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
