Skip to content

Memcached Management in VS Code

Memcached is an open-source, high-performance, distributed memory object caching system. It is built for:

  • Speed: A simple in-memory key-value store with microsecond access times
  • Simplicity: A small, well-defined set of operations (get, set, delete, touch)
  • Distribution: Scales horizontally across many nodes
  • Volatility: Items expire or are evicted under memory pressure - Memcached is a cache, not a system of record

Memcached is most commonly used to cache the results of database queries, API calls, and page rendering to reduce load and latency.

To connect to Memcached in DBCode:

  1. Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
  2. Add a New Connection: Click on the “Add Connection” icon.
  3. Complete the connection form: Select Memcached as the database type and enter:
    • Host address (default port: 11211), or a unix socket path
    • Optional username / password (text-protocol auth)
    • Optional SSL/TLS configuration (host connections only)
  4. Connect: Click save to connect to your Memcached server.

For detailed instructions on connecting, refer to the Connect article.

DBCode connects over the Memcached text protocol and gives you:

  • Key browsing: Keys are listed via lru_crawler metadump and grouped by their : prefix into keyspaces, plus an “All Keys” view
  • Item editing: View and edit a key’s value, TTL, and flags; create and delete keys
  • Raw commands: Run any Memcached command (get, set, stats, flush_all, and more) from the query editor
  • Server stats: Monitor connections, memory, hit rate, throughput, and slab allocation

Memcached is a cache, so a few behaviors differ from a traditional database:

  • Key listing is a point-in-time snapshot. Items can expire or be evicted between listing and reading, so a browse may not reflect every key, and very large caches are capped by the Max Keys connection setting.
  • TTL semantics. A TTL up to 30 days is stored as a relative offset; a larger value is converted to an absolute expiry timestamp. A TTL of 0 means “never expire”.
  • Authentication. DBCode uses the text protocol (required for key browsing). Servers that require SASL authentication (binary protocol only) are not supported, because Memcached itself does not allow key enumeration over the SASL/binary protocol.

For more information about Memcached, check out memcached.org.