Memcached

From ArchWiki
Jump to navigation Jump to search

From Wikipedia:memcached:

Memcached (pronunciation: mem-cashed, mem-cash-dee) is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.

The system uses a client–server architecture. The servers maintain a key–value associative array; the clients populate this array and query it by key. Keys are up to 250 bytes long and values can be at most 1 megabyte in size.

Clients use client-side libraries to contact the servers which, by default, expose their service at port 11211. Both TCP and UDP are supported. Each client knows all servers; the servers do not communicate with each other. If a client wishes to set or read the value corresponding to a certain key, the client's library first computes a hash of the key to determine which server to use. This gives a simple form of sharding and scalable shared-nothing architecture across the servers.

Installation

Install the memcached package.

Configuration

Since 1.5.6 memcached defaults to listening only on TCP. -l allows you to bind to specific interfaces or IP addresses By default, memcached listens for connections only on local network interfaces. It may be preferred to change the -l option to allow listening on external addresses instead. See memcached(1).

Edit memcached.service to change the parameter.

Then start and/or enable memcached.service.

Client-side software

See also