Explain SET & GET command.

SET command used to set a value to the key and GET command to get a value of the key as follows, of data-type STRING.
127.0.0.1:6379> SET TEST_KEY TEST_VALUE

OK [TEST_VALUE is being set to TEST_KEY]

127.0.0.1:6379> GET TEST_KEY

"TEST_VALUE"
SET Command with NX|XX arguments
 
NX argument indicates that SET a value to the key if the key is not exist;
 
XX argument indicates that SET a value to the key only if the key already exists;
 
Example:
 
NX: key TEST_KEY is already exist; If we try to update TEST_KEY value, it will not accept and returns (nill) status
127.0.0.1:6379> SET TEST_KEY TEST_VALUE_UPDATED NX

(nil)

127.0.0.1:6379> GET TEST_KEY

"TEST_VALUE"
Value of TEST_KEY remain same;
 
XX: key TEST_KEY is alrady exists; Hence so, when we try to udpate TEST_KEY value, its updated and ack OK
127.0.0.1:6379> SET TEST_KEY TEST_VALUE_XX_UDPATED XX

OK

127.0.0.1:6379> GET TEST_KEY

"TEST_VALUE_XX_UDPATED"