Easy Tutorial
❮ Memcached Stats Slabs Memcached Get Cas Data ❯

Memcached Connection

We can connect to the Memcached service by using the telnet command and specifying the host IP and port.

Syntax

telnet HOST PORT

In the command, HOST and PORT are the IP and port on which the Memcached service is running.

Example

The following example demonstrates how to connect to the Memcached service and execute simple set and get commands.

In this example, the Memcached service is running on the host 127.0.0.1 (localhost) and port 11211.

telnet 127.0.0.1 11211

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

set foo 0 0 3                                                   Save command

bar                                                             Data

STORED                                                          Result

get foo                                                          Get command

VALUE foo 0 3                                                    Data

bar                                                             Data

END                                                             End line

quit                                                            Exit
❮ Memcached Stats Slabs Memcached Get Cas Data ❯