Using MemCached with PHP

Memcached is a distributed memory caching system. It speeds up websites having large dynamic databasing by storing database object in Dynamic Memory to reduce the pressure on a server whenever an external data source requests a read. A memcached layer reduces the number of times database requests are made.

In Layman’s Terms

Let’s conjure up an analogy. Suppose you are a manager of a DVD store which has lots of movies and games with different genres like sci-fi, history and drama. You assign some keys to the movies that customers ask for a lot and paste them on a front counter for the ease of the store keeper. Now these assigned keys can be circulated among your customers and whenever these customers request that particular key, your store keeper doesn’t have to get into the details of the movies but just fetch them the DVDs. This will increase the response time of your store keeper. All the requests for which the keys are not found will be looked into in detail to find out which movies the customers are requesting.

The delivery process will be as rapid as the assignment of the keys. These keys act as speed buffer by passing all the details one has to look into for fetching movies.

These same things happen to the content your web page is serving. Memcached stores the values (v) with the key (k) and retrieves the values (v) with the key (k) without even parsing the database queries and stays away from all these hassles.

Why Memcached?

It increases the response time of your web pages, which in return enhances the overall customer’s experience. A better response time allows users to fetch data seamlessly.

How to setup Memcached?


Originally published at www.laravelfeed.com.