Memcache is basically is a generalpurpose distributed memory caching system.
it allows you to store any form of data in a ‘temporary cache’ so wherever you go to do a database query, instead of just connecting to the database and getting the data we want we first check the memcache to see if our data is already stored. If the memcache returns nothing, then go to the database, get what you’re looking for, then store it in the memcache
There are five main functions that we use with Memcache and they are as follows:
get() – gets the value for a specified key
set() – sets a given key with a given value
add() – adds to the cache, only if it doesn’t already exist
replace() – sets in the cache only if the key already exists
flush() – removes all keys and cached data