Written by - Yash Agrawal

Introduction


Memcached is a free, open-source, high-performance, distributed memory object caching system. Memcached is used to speed up dynamic web applications by reducing the database load. Memcached is used by all the major websites having huge data for example, YouTube, Wikipedia, Twitter etc.

In this page you will leave about. History of Memcached, Features of Memcached, Disadvantages of Memcached, How Does Memcached Work, Installation Process of Memcached, Memcached Storage Commands, How to set, get, replace, delete data in Memcached etc.

What is Memcached

It is free open source distributed memory object caching system. It is high in performance and is used by a lot of companies. Memcached is used to reduce the load on Database making the API call faster.

Example: Suppose if there is a trending post which is accessed by thousands of people and is stored in database, this will certainly create a load on database as on request database has to run a query. Thus, for this problem we just save the post details into the local server system so that on each request we just have to look at the key to serve the data.

Memcached is used in memory caching software because it is very easy to install on any Windows or Unix system. It offers API integration for all the major languages like PHP, Java, C/C++, Python, Ruby, Perl etc.

History of Memcached

Memcached was originally developed by Brad Fitzpatrick from Danga Interactive for LiveJournal in 2003. It was written in Perl, but is rewritten in C by Anatoly Vorobey.

Memcached is made up of 4 main components. These components allow the client and the server to work together in order to deliver cached data as efficiently as possible:.

  1. Client Software: Provides the list of Memcached server.
  2. A Client-based hashing algorithm: It choose the server based on key.
  3. Server Software: It is used to store values and their keys into an internal hash table.
  4. LRU: LRU stands for Least Recently Used. This determines when to throw out old data or reuse memory.

Disadvantages of Memcached

  1. There is no way to iterate over all of the cached items. Until you know the key.
  2. It is not a persistent datastore.
  3. It is not a in-memory cache making it slower.