Damp

Memcached

Distributed memory caching system

High-performance distributed memory caching system using Memcached Alpine.

Docker Configuration

Image: memcached:alpine
Ports: 11211:11211

DAMP identifies the service using Docker labels. Container name is auto-generated by Docker. Memcached stores data in memory only - no persistent storage.

Port Configuration

Default ports: 11211 (host) → 11211 (container)

If port 11211 is occupied on the host machine, DAMP automatically uses the next available port. Check the DAMP interface to see the actual port assigned.

Memcached stores data in memory only - restarting clears all cached data.

Connection Information

From Host Machine (Windows)

Connect from your Windows host to the Memcached service.

telnet localhost 11211

Connection Details:

  • Host: localhost
  • Port: 11211 (or actual port shown in DAMP)

From Project Containers

Connect from your DevContainers or other Docker containers to the Memcached service.

Use the container name or ID shown in the DAMP interface.

# Using container name from DAMP
telnet [container-name] 11211

Laravel .env Configuration:

CACHE_DRIVER=memcached
MEMCACHED_HOST=[container-name]
MEMCACHED_PORT=11211

Replace [container-name] with the actual container name displayed in DAMP.

Laravel Setup

Install PHP Extension

# In your devcontainer
pecl install memcached

Configuration

// config/cache.php
'memcached' => [
    'driver' => 'memcached',
    'servers' => [
        [
            'host' => env('MEMCACHED_HOST', '127.0.0.1'),
            'port' => env('MEMCACHED_PORT', 11211),
            'weight' => 100,
        ],
    ],
],

Usage Examples

// Store cache
Cache::put('key', 'value', 3600);

// Retrieve cache
$value = Cache::get('key');

// Check if exists
if (Cache::has('key')) {
    //
}

When to Use Memcached

Memcached is suitable for:

  • Simple key-value caching
  • Distributed caching across multiple servers
  • Session storage in multi-server setups

For data persistence, complex data structures, or pub/sub messaging, use Redis or Valkey instead.

On this page