Docs / Performance Optimization / How to Set Up Memcached for Caching

How to Set Up Memcached for Caching

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 135 views · 1 min read

Memcached is an in-memory caching system that speeds up applications by caching database queries and API calls.

Install

apt install memcached libmemcached-tools -y

Configure

Edit /etc/memcached.conf:

-m 128          # Memory in MB\n-p 11211        # Port\n-l 127.0.0.1    # Listen address\n-c 1024         # Max connections
systemctl restart memcached

PHP Integration

apt install php-memcached -y\nsystemctl restart php8.3-fpm

Monitor

memcstat --servers=localhost

Was this article helpful?