Support Online
Skip to main content

Redis String Management: Basic Commands and User Guide

What Will You Learn in This Guide?

This guide explains the Redis String data type in detail.
Teaches key-value creation, reading and updating operations.
Covers numeric and textual string usage scenarios.

🧠 Technical Summary

Main topic: Redis String (text arrays) management.
Solved problem: Quickly storing and manipulating individual data.
Steps followed: Data creation, reading and manipulation.


1. Creating a Text Array (String)

In Redis, each key holds only a single value.
String values ​​are binary-safe and limited to 512 MB.

Creating a Single Record

SET tr1_mesaj01 "Merhaba"
  • This command assigns a string value to a key.

Creating Bulk Records


MSET tr1_mesaj02 "Dünya" tr1_mesaj03 "Bulut"
  • This command creates multiple keys at once.

Creating with APPEND


APPEND tr1_mesaj04 "GenixNode Altyapisi"
  • If the key does not exist, it creates it and if it exists, it adds it to the end.
  • Returns the total number of characters as output.

2. Reading and Viewing Data

Single Data Reading


GET tr1_mesaj01
  • This command returns the value of the key.

Multiple Data Reading


MGET tr1_mesaj01 tr1_mesaj02 tr1_mesaj03
  • Returns nil for keys that do not exist.

3. Data Manipulation

  1. Math can be done if the string contains only numbers.

Numerical Boost


SET sayac 10
INCR sayac
INCRBY sayac 5
  • The value becomes 11 and 16 respectively.

Numerical Reduction


DECRBY sayac 10
  • The value decreases by 10 units.

Adding Text


APPEND tr1_mesaj01 " Turkiye"
  • A new expression is added to the end of the string.

Note: If text is added to the number, INCR will no longer work.


❓ Frequently Asked Questions (FAQ)

1. How much data does a Redis String hold? A string key stores a maximum of 512 MB of data.

2. Can APPEND be used on numeric data? Yes, but the data can be converted to text.

3. What happens if SET is applied to a key with a different data type? The old data is deleted and a new string is written.

4. Does a missing key produce an error during MGET? No, it just returns nil.


🎯 Result

Redis String is the most basic and fastest data type. Ideal for storing counters, messages and tokens. Correct use directly affects performance.

You can try your Redis projects on the GenixNode infrastructure immediately.