Hello World in Redis
This section will excite programmers the most. Let's get our hands dirty and punch in some code. But, before that, we have to understand that Redis works on a client-server model and uses the Redis protocol to communicate with the server. For the client to connect to the server, the client has to know the location of the server. For this section, I am going to show samples using the redis-cli and Java clients.
Hello World using redis-cli
Start the Redis client Command Prompt (make sure that the server is running). Type in the following commands, as shown in the following screenshot, and see the outcome:
There are three parts to the command we wrote. They are explained as follows:
Set
: This command is used to set a value in the Redis serverMSG
: This is the key for the message to be stored in the Redis serverHello World
: This is the value stored in the server for theMSG
key
So, this clears a pattern that we have...