Introduction To Memcached with Telnet and Python

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/introduction-memcached-telnet-python/
PINTEREST
PINTEREST
INSTAGRAM

We have successfully installed and stated Memcached. Now we will simply connect to the Memcached and work simple operations.

Connect To The Memcached with Telnet

The simples tool to connect Memcached and make operations is telnet. Memcached default tcp port is 11211 so to connect memcached we will issue following commands.

Set Simple Value to Memcached with Telnet

We will set simple value to the memcached to test it.

Ok there is no problem it seems. Using telnet is the simplest way but not a productive and practical way. So to store values into the Memcached we will write some applications in different languages. We prefer here python because its simplicity and popularity.

Install Python3 for Memcached

We will install python3 libraries for Memcached. There are alternatives for libraries by the way.

Write Simple Python App for Memcached

Open python3 interactive shell for issuing commands.

Import Memcached library to the shell.

LEARN MORE  How To Get Today's Date?

Create a connection to the Memcached services with default settings.

Create some data as python dictionary object.

Add the data to the Memcached with “sample” tag and for 15 minutest. After 15 minutes our object will be automatically deleted.

All of the code

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/introduction-memcached-telnet-python/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)