Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Memcached Adapter

Memcached Adapter Laravel Package

cache/memcached-adapter

PSR-6 and PSR-16 cache pool backed by the Memcached extension, with tag and hierarchical key support, native bulk operations, and binary protocol enabled by default.

View on GitHub
Deep Wiki
Context7

Cache\Memcached\Adapter provides PSR-6 and PSR-16 cache implementations backed by the native Memcached extension. It supports tags and hierarchical keys, and enables Memcached's binary protocol by default—pass an option map as the second constructor argument to override settings like timeouts or protocol mode.

  • Native bulk operations for getMultiple(), setMultiple(), and deleteMultiple()
  • Throws CachePoolException when getMulti() fails instead of returning silent misses
  • Tagged items store a generation snapshot, with a separate marker per tag
  • Configurable client options via an associative Memcached option map
Frequently asked questions about Memcached Adapter
How do I configure this package to work with Laravel’s Cache facade?
Add the package via Composer, then define a `memcached` driver in `config/cache.php` with your Memcached server details. Use it via `Cache::store('memcached')->put('key', 'value')` or set it as the default in `config/app.php`. No extra Laravel packages are needed.
Does this support Laravel’s tag-based cache invalidation?
Yes, this adapter implements PSR-6’s `CacheItemPoolInterface`, so you can use tags for invalidation (e.g., `$item->setTags(['user', 'profile'])`). This is useful for bulk invalidation, like clearing all caches for a user after an update.
What Laravel versions does this package support?
The package adheres to PSR-6, which Laravel 5.5+ fully supports. Tested with Laravel 6–9, but verify compatibility with your version since the last release was in 2022. No Laravel-specific dependencies exist beyond PSR-6.
Can I use this for Laravel session storage instead of file/database?
Yes, this adapter works with Laravel’s session drivers if you configure Memcached as the session store. It’s faster than file-based sessions but lacks persistence (data is lost on Memcached server restarts). Use `memcached` in `config/session.php`.
How do I handle Memcached server failures in production?
Configure multiple servers with weights in `config/cache.php` for failover. For critical data, pair this with a fallback driver (e.g., `file` or `database`) in Laravel’s cache configuration. Monitor server health using tools like `memcached-tool` or custom scripts.
Is this package actively maintained? Should I use it in production?
The last release was in 2022, with no recent commits or security updates. While PSR-6 compliance reduces risk, evaluate your tolerance for potential compatibility issues with newer PHP/Laravel versions. Consider forks or alternatives if maintenance is critical.
How does performance compare to Laravel’s Redis driver?
Memcached is generally faster for simple key-value operations due to lower overhead, but lacks Redis features like persistence, Lua scripting, or advanced data structures. Benchmark both for your workload—Memcached excels in high-throughput, low-latency scenarios like API caching.
Can I use this for Laravel Echo/Pusher presence channels?
Yes, this adapter works with Laravel Echo if you configure Memcached as the broadcast driver. Replace `redis` with `memcached` in `config/broadcasting.php` and ensure your Memcached servers are accessible from your Laravel app’s environment.
What are the system requirements for using this package?
You need the `ext-memcached` PHP extension installed and enabled. Verify support across your deployment environments (e.g., shared hosting may block extensions). Docker users should include `php:memcached` in their `Dockerfile` or `docker-compose.yml`.
Are there alternatives if I need persistence or compression?
For persistence, use Laravel’s `redis` driver (with Redis) or `database` driver. For compression, Redis supports it natively, while Memcached requires manual handling (e.g., `gzip` before storing). If you need both, consider `predis/predis` (Redis) or `spatie/laravel-cache-prefixes` for key management.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo