Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Memcached Connection

Memcached Connection

We can connect to the Memcached service via the telnet command, specifying the host IP and port.

Syntax



telnet HOST PORT

In the command, the HOST and PORT is the IP and port of the running Memcached service.

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 runs on host 127.0.0.1 (localhost), 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                                                   保存命令



bar                                                             数据



STORED                                                          结果



get foo                                                         取得命令



VALUE foo 0 3                                                   数据



bar                                                             数据



END                                                             结束行



quit                                                            退出