This topic describes the syntax, feature description, parameters, and return values of storage functions. This topic also provides examples of these functions.
shm_get
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | shm_get(k)
|
Feature | Obtains the value corresponding to the key specified by the shared memory system. |
Parameter | k: the value of the key that you want to obtain. Data type: string. |
Return value | Returns the value corresponding to the key if the function is executed. Otherwise, a value of false is returned. |
Example | Output
|
shm_set
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | shm_set(k, v [, exptime])
|
Feature | Configures a key-value pair into the shared memory system. |
Parameters |
|
Return value | Returns a value of true if the function is executed. Otherwise, a value of false is returned. |
Example | Output
|
shm_add
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | shm_add(k, v [, exptime])
|
Feature | Use this function in the same way as the shm_set function. However, this function configures a key-value pair into the shared memory system only if the key does not exist. |
Parameters |
|
Return value | Returns a value of true if the function is executed. Otherwise, a value of false is returned. |
Example | Output
|
shm_del
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | shm_del(k)
|
Feature | Deletes a key-value pair from the shared memory system. |
Parameter | k: the key that you want to delete. |
Return value | Always returns a value of true. |
Example |
|
shm_incr
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | shm_incr(k, step [, init])
|
Feature | Atomically and automatically increments the numeric value corresponding to the key in the shared memory system. |
Parameters |
|
Return value | Returns a value of true if the function is executed. Otherwise, a value of false is returned. |
Example | Output
|
redis_get
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | redis_get(k)
|
Feature | Obtains the value of the key specified in the ApsaraDB for Redis nodes. |
Parameter | k: the value of the key that you want to obtain. |
Return value | Returns a value of true if the function is executed. Otherwise, a value of false is returned. |
Example | Output
|
redis_set
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | redis_set(k, v [, exptime])
|
Feature | Configures a key-value pair into the ApsaraDB for Redis nodes. |
Parameters |
|
Return value | Returns a value of true if the function is executed. Otherwise, a value of false is returned. |
Example | Output
|