Introduction of Memcached

Memcached is a high-performance distributed memory object caching system for dynamic Web applications to reduce database load. It speeds up dynamic, database-driven web sites by caching data and objects in memory to reduce the number of database reads. Memcached is based on a Hashmap that stores key/value pairs. Its daemons are written in C, but clients can be written in any language and communicate with the daemons over the Memcached protocol.

Common Commands

The command instructions usage
set Set the key value value set key flags exptime bytes [noreply] value
add Add key value value (not overwrite the original value) add key flags exptime bytes [noreply] value
replace Replace the original value replace key flags exptime bytes [noreply] value
append Appends the original value append key flags exptime bytes [noreply] value
prepend Append the value to the original value prepend key flags exptime bytes [noreply] value
get Gets the value stored in the key get key […key1]
delete Delete an existing key delete key [noreply]
incr/decr Incrementing or decrement the value of an existing key incr/decr key increment_value

Usage scenarios

  • Cache frequently fetched data (reduce DB stress);
  • Control flow by locking mechanism;
  • Sharing data between multiple servers (such as sessions)

note

Redis (SSDB) is rich in data types, while Memcached is a single data type. Memcached is an in-memory caching system, while Redis is more like an in-memory database. Both why want to compare ???? In my opinion, Memcached+SSDB can support a lot of projects. If you need real time and high concurrency, consider Redis.

reference

1.www.w3cschool.cn/memcached/