The system caches data and objects in memory to minimize the frequency with which an external database or API (application program interface) must be accessed.
In the Memcached system, each item comprises a key, an expiration time, optional flags, and raw data. When an item is requested, Memcached checks the expiration time to see if the item is still valid before returning it to the client. The cache can be seamlessly integrated with the application by ensuring that the cache is updated at the same time as the database.
By default, Memcached acts as a Least Recently Used cache plus expiration timeouts. If the server runs out of memory, it looks for expired items to replace. If additional memory is needed after replacing all the expired items, Memcached replaces items that have not been requested for a certain length of time (the expiration timeout period or longer), keeping more recently requested information in memory.
Memcached consists of four fundamental components:
- Client software, which receives a list of available Memcached servers.
- A client-based hashing algorithm, which chooses a server based on the key input.
- Server software, which stores the values with their keys into an internal hash table.
- Server algorithms, which determine when to discard old data or reuse memory.
Continue Reading About Memcached
- The Memcached site describes how the system works along with installation, configuration, use, and maintenance instructions.