The tool that we are creating for Redis will support three commands:
- add - adds a new session record
- remove - removes a session record by key (that is, by username)
- list - prints all session records
We need constants for the name of every subcommand to prevent mistakes in strings in the code:
const SESSIONS: &str = "sessions";
const CMD_ADD: &str = "add";
const CMD_REMOVE: &str = "remove";
const CMD_LIST: &str = "list";
This list also contains the SESSION constant as the name of the HashMap in Redis. Now, we can declare functions to manipulate session data.