PHPackages                             nytris/memcached - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. nytris/memcached

ActiveProject[Caching](/categories/caching)

nytris/memcached
================

v0.0.9(1y ago)26.0k↓50%MITPHPPHP &gt;=8.1

Since Aug 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nytris/memcached)[ Packagist](https://packagist.org/packages/nytris/memcached)[ RSS](/packages/nytris-memcached/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (13)Versions (10)Used By (0)

Nytris Memcached
================

[](#nytris-memcached)

[![Build Status](https://github.com/nytris/memcached/workflows/CI/badge.svg)](https://github.com/nytris/memcached/actions?query=workflow%3ACI)

Standard PECL `ext-memcached` with dynamic mode/auto-discovery support for Memcached AWS ElastiCache.

Why?
----

[](#why)

Use the stable and performant standard ext-memcached from PECL while still taking advantage of AWS ElastiCache auto-discovery.

How does it work?
-----------------

[](#how-does-it-work)

References to `ext-memcached`'s `Memcached` class will be replaced using [PHP Code Shift](https://github.com/asmblah/php-code-shift)to references to the `src/Memcached/MemcachedHook.php` class in this package.

Additionally, [session connections can also take advantage of auto-discovery](#sessions-support).

When adding a server, if dynamic mode is enabled for this package in `nytris.config.php`, the AWS ElastiCache auto-discovery feature will be used, and all discovered nodes added to the `Memcached` instance.

Currently, by default the following references to `Memcached` will be hooked, but this can be customised using `new MemcachedPackage(memcachedClassHookFilter: ...)`:

- [Stash's Memcached sub-adapter](https://github.com/tedious/Stash/blob/e02ac18/src/Stash/Driver/Sub/Memcached.php#L67)
- [Symfony Cache's Memcached adapter](https://github.com/symfony/cache/blob/5460647/Adapter/MemcachedAdapter.php#L99)

Usage
-----

[](#usage)

Install this package with Composer:

```
$ composer require nytris/memcached tasque/tasque tasque/event-loop
```

Configure Nytris platform:

`nytris.config.php`

```
