Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Memcached is a transient, distributed in-memory key-value cache: your application asks a Memcached client to look up a key, fetches the underlying data if the key is missing, then stores the result with an expiration time. Installing the server alone does not make an application use the cache.

This guide covers the basic setup, application flow, command-line concepts, expiration rules, and ways to investigate misses and evictions. For a concise command reference, see the DZone Refcard #250, “Getting Started With Memcached,” by James Sugrue.

What Memcached does—and what it does not

Memcached stores small, arbitrary values in memory so an application can reuse results such as database queries, API responses, or rendered pages instead of calculating or fetching them on every request. It is a cache, not durable storage or database middleware. The project describes it as “a developer tool, not a ‘code accelerator’, nor is it database middleware.” See the Memcached project overview.

Memcached servers are independent. The application’s client chooses a server for a key; servers do not synchronize with one another, replicate data, or broadcast updates. Treat cached entries as disposable: they can disappear through expiration, eviction, or a server restart.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Install and start the Memcached server

Use the package manager for your operating system when possible. The official configuration guide gives these package examples:

  • Debian or Ubuntu: apt-get install memcached
  • Red Hat or Fedora: yum install memcached
  • macOS with Homebrew: brew install memcached

Package names and service-management steps can vary by distribution and release. Check your operating system’s package and service documentation if these commands do not match your setup. For source builds, Memcached requires libevent and a C compiler. The official configuration guide describes the main runtime options, including -m for item-storage memory in megabytes, -d to run as a daemon, and -v for verbose output.

The project’s downloads page listed Memcached 1.6.45, dated July 9, 2026, at the time reflected by the project information here. Releases change; check the official downloads page for the current version rather than assuming that number is still latest.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Connect your application: the cache-aside pattern

Memcached does not automatically intercept database or API traffic. Your application needs a compatible client library and code that reads and writes cache entries. A typical cache-aside request follows this sequence:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Build a key that identifies the requested data, such as a product record or a query result.
  2. Ask the Memcached client for that key.
  3. If the value exists, return it to the caller.
  4. If the key is missing, fetch the data from the database or API and process it as needed.
  5. Serialize the result into a value the client can store, write it to Memcached with a TTL, and return it.

The official user guide calls fetching something, possibly processing it, and putting it in the cache to expire after a chosen interval the “hello world” of Memcached. See the Memcached user guide. The particular client library and connection setup depend on your application’s language and framework; the installation command for the server does not select or configure that library for you.

Understand keys, values, and expiration

A Memcached item includes a key, flags, an expiration, a CAS value, and arbitrary data. ASCII keys are limited to 250 bytes, so avoid long serialized objects or user-controlled text as raw keys. Use a compact, predictable key scheme and encode or hash components when necessary. The basic protocol documentation describes item and command semantics.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

TTL boundaries

Expiration is specified in seconds. A TTL of 0 means no expiration time is set. Values up to 30 days are interpreted as relative durations; values greater than 30 days are interpreted as Unix timestamps, not as longer relative durations. This boundary matters if an application computes TTLs dynamically: a value intended as “days from now” beyond 30 days may otherwise be read as a date in the past.

Choose freshness deliberately

Set a TTL according to how long stale data is acceptable, not simply to maximize cache hits. When the underlying record changes, delete the related entry or overwrite it with the new value. Keep expiration as a fallback for missed invalidations, application crashes, or network failures. A TTL is a freshness limit, not a guarantee that an item remains available until that time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Basic Memcached commands

These are protocol command names, useful when learning the data model or inspecting a server with a compatible text-protocol connection. Most applications should issue them through their client library rather than constructing protocol traffic by hand.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Command Purpose
set Store a value, creating or overwriting the item.
add Store a value only if the key is absent.
replace Store a value only if the key already exists.
append / prepend Add data to the end or beginning of an existing value.
cas Compare-and-swap: update an item only if its CAS value still matches the version observed by the client.
get / gets Retrieve an item; gets also returns the CAS value used for conditional updates.
delete Remove an item by key.
incr / decr Increment or decrement a stored numeric value.
stats Return server statistics.

For full protocol details and response behavior, use the official basic protocol reference. Command availability and exact argument formats depend on the protocol mode and client in use.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why a key can disappear before its TTL

Memcached is not a durable database. A restart begins with an empty dataset, and memory pressure can remove an item whose expiration time has not arrived. Items are organized into slab classes; if a class has no free chunks and there are no free pages to assign to it, Memcached can evict items from the tail of that class’s least-recently-used (LRU) list. The performance guide describes this eviction condition.

Consequently, a cache miss does not prove that an item’s TTL elapsed. Application logic must be able to rebuild any cache entry from its authoritative source.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Monitor hits, storage, and evictions

Start with the server’s statistics commands or a compatible monitoring tool. The maintenance guide documents these useful checks:

  • stats for general server counters, including hits and sets.
  • stats items for item-level statistics grouped by slab class.
  • stats slabs for slab allocation and usage information.

Compare get_hits with cmd_set by slab to understand whether the cache is serving the classes receiving writes. Watch evicted and evicted_nonzero for evidence of items removed before their expiration. These counters are diagnostic signals, not a complete explanation by themselves: interpret them alongside workload patterns and slab distribution. See the maintenance guide.

A practical checklist before relying on the cache

  • Keep the database or API as the authoritative source; cache misses and lost entries must be safe.
  • Choose stable, compact keys that remain within the 250-byte ASCII key limit.
  • Set TTLs with the 30-day relative-expiration boundary in mind.
  • Invalidate or overwrite affected entries when source data changes, while retaining expiration as a safety net.
  • Size the memory setting for the workload and monitor slab distribution and early evictions.
  • Use a client library in application code; a running daemon by itself does not cache requests.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.