All Products
Search
Document Center

Create a key

Last Updated: Jun 08, 2019

This section describes how to create a key.

Prerequisites

You must have access permissions to DMS and be logged on to the DMS console.

Procedure

  1. Select an ApsaraDB for Redis instance and then click Log on to Database.

  2. After you log on to the instance, select a database to create the key from the drop-down list, as shown in the following figure:

    redis-create-key-1

  3. Click New shown in the preceding figure. The New Key window is displayed.

  4. Enter a key name, select the type of the value from the drop-down list, and then click OK. The value editing window is displayed.

    Note

    The value editing window varies depending on the type of the value.

  • Value type 1: String

    The following figure shows the editing window for String type values:

    redis-create-key-string

    1. Enter the value in the Value text box.

    2. Click Submit. A dialog box appears displaying the command that is used to create the key.

    3. Click OK to create the key.

  • Value type 2: List

    The following figure shows the editing window for List type values:

    redis-create-key-list

    1. Enter the value in the Value list. To add multiple values, click Add to Top to add the values to the top of the list or click Add to Bottom to add the values to the bottom of the list.

    2. Click Submit. A dialog box appears displaying the command that is used to create the key, as shown in the following figure:

      redis-create-key-list-confirm

    3. Click OK to create the key.

  • Value type 3: Hash

    The following figure shows the editing window for Hash type values:

    redis-create-key-hash

    1. Enter the value in the Value list. To add multiple values, click New.

      Note

      A valid data entry must contain a key and a value. You cannot use the same key in different data entries. Different data entries can have the same value.

    2. Click Submit. A dialog box appears displaying the command that is used to create the key.

    3. Click OK to create the key.

  • Value type 4: Set

    The following figure shows the editing window for Set type values:

    redis-create-key-set

    1. Enter the key value in the Value list. To add multiple values, click New. You cannot use the same value in different data entries.

    2. Click Submit. A dialog box appears displaying the command that is used to create the key.

    3. Click OK to create the key.

  • Value type 5: ZSet(Sorted Set)

    The following figure shows the editing page for ZSet type values:

    redis-create-key-zset

    1. Enter the value in the Value list. To add multiple values, click New.

      Note

      A valid data entry must contain a value and a score. You cannot use the same value in different data entries. Different data entries can have the same score. Valid scores include integers and decimals.

    2. Click Submit. A dialog box appears displaying the command that is used to create the key.

    3. Click OK to create the key.