A look-aside cache is a cache deployed apart from the database and outside the web server, which calls it.
Memcached is an in-memory distributed hash table, and a write to it is a deletion:
- A get for key 1 returns 10 from the cache.
- A set of key 1 to 30 removes the entry from the cache and writes 30 to the database.
- The next get for key 1 is a cache miss. The value 30 is fetched from the database and populated in the cache.
So the cache takes two operations, an add and a delete.
An engineer does not manage any of this. The code imports a client library, called mcrouter, and calls get, set and delete. The client does serialization, compression, request routing, error handling and request batching. It is deployed along with the code, as a Mailchimp or an AWS client is, and adoption across the organization is very high.
Fetching 1,700 items is likely to hit a failure and a retry, so tail latencies are high.