PHPackages                             josephscott/marmerine - 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. josephscott/marmerine

ActiveLibrary[Caching](/categories/caching)

josephscott/marmerine
=====================

An alternate Memcached implementation

0.0.3(4y ago)481[4 issues](https://github.com/josephscott/marmerine/issues)[1 PRs](https://github.com/josephscott/marmerine/pulls)MITPHPPHP &gt;=8.1.0CI passing

Since Feb 1Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/josephscott/marmerine)[ Packagist](https://packagist.org/packages/josephscott/marmerine)[ RSS](/packages/josephscott-marmerine/feed)WikiDiscussions trunk Synced 2w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Marmerine
=========

[](#marmerine)

This is an alternate Memcached implementation.

```
git clone https://github.com/josephscott/marmerine.git
composer install
php server.php start

```

Storage Commands
----------------

[](#storage-commands)

### `set`

[](#set)

- **Supported:** Yes ✅
- **Format:** `set     [noreply]\r\n\r\n`
- **Success Response:** `STORED\r\n`
- **Error Response:** `CLIENT_ERROR [error]\r\nERROR\r\n`

**Examples**

```
$ printf "set thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
```

```
$ printf "set thing 0 300 3\r\nabc123XYZ\r\n" | nc localhost 11211
CLIENT_ERROR bad data chunk
ERROR
```

**Description**

This will store the value of the given key, even if it already exists.

### `add`

[](#add)

- **Supported:** Yes ✅
- **Format:** `add     [noreply]\r\n\r\n`
- **Success Response:** `STORED\r\n`
- **Failure Response:** `NOT_STORED\r\n`
- **Error Response:** `CLIENT_ERROR [error]\r\nERROR\r\n`

**Examples**

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
```

```
$ printf "add thing 0 300 3\r\nabc123XYZ\r\n" | nc localhost 11211
CLIENT_ERROR bad data chunk
ERROR
```

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
NOT_STORED
```

**Description**

This will store the value of the given key, only if it does not already exist.

### `replace`

[](#replace)

- **Supported:** Yes ✅
- **Format:** `replace     [noreply]\r\n\r\n`
- **Success Response:** `STORED\r\n`
- **Error Response:** `NOT_STORED\r\n`

**Examples**

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "replace thing 0 300 12\r\nabc-REPLACED\r\n" | nc localhost 11211
STORED
$ printf "get thing\r\n" | nc localhost 11211
VALUE thing 0 12
abc-REPLACED
END
```

```
$ printf "replace thing 0 300 3\r\nabc\r\n" | nc localhost 11211
NOT_STORED
```

**Description**

This will replace the value of the given key.

### `append`

[](#append)

- **Supported:** Yes ✅
- **Format:** `append     [noreply]\r\n\r\n`
- **Success Response:** `STORED\r\n`
- **Error Response:** `NOT_STORED\r\n`

**Examples**

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "append thing 0 300 6\r\n-AFTER\r\n" | nc localhost 11211
STORED
$ printf "get thing\r\n" | nc localhost 11211
VALUE thing 0 9
abc-AFTER
END
```

```
$ printf "append thing 0 300 6\r\n-AFTER\r\n" | nc localhost 11211
NOT_STORED
```

**Description**This will append a string to the value of an existing key.

### `prepend`

[](#prepend)

- **Supported:** Yes ✅
- **Format:** `prepend     [noreply]\r\n\r\n`
- **Success Response:** `STORED\r\n`
- **Error Response:** `NOT_STORED\r\n`

**EXAMPLES**

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "prepend thing 0 300 7\r\nBEFORE-\r\n" | nc localhost 11211
STORED
$ printf "get thing\r\n" | nc localhost 11211
VALUE thing 0 10
BEFORE-abc
END
```

**Description**This will prepend a string to the value of an existing key.

### `cas`

[](#cas)

- **Supported:** Yes ✅
- **Format:** `cas      [noreply]\r\n\r\n`
- **Success Response:** `STORED\r\n`
- **Error Resposne:** `NOT_STORED\r\n`

**EXAMPLES**

```
$ printf "set thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "gets thing\r\n" | nc localhost 11211
VALUE thing 0 3 1
abc
END
$ printf "cas thing 0 300 3 1\r\nXYZ\r\n"| nc localhost 11211
STORED

```

**Description**

Set a new value for a key if the cas token hasn't changed.

### `touch`

[](#touch)

- **Supported:** Yes ✅
- **Format:** `touch   [noreply]\r\n`
- **Success Response:** `TOUCHED\r\n`
- **Error Resposne:** `NOT_FOUND\r\n`

**Examples**

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "touch thing 1800\r\n" | nc localhost 11211
TOUCHED
```

**Description**

Update the expiration time of an existing key.

Retrieve Commands
-----------------

[](#retrieve-commands)

### `get`

[](#get)

- **Supported:** Yes ✅
- **Format:** `get  [key2 key3 ... keyn]\r\n`
- **Found Response:** `VALUE   \r\n\r\nEND\r\n`
- **Not Found Response:** `END\r\n`

**Examples**

```
$ printf "set thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "get thing\r\n" | nc localhost 11211
VALUE thing 0 3
abc
END
```

```
$ printf "get thing\r\n" | nc localhost 11211
END
```

```
$ printf "set thing1 0 300 4\r\n1abc\r\n" | nc localhost 11211
STORED
$ printf "set thing2 0 300 4\r\n2abc\r\n" | nc localhost 11211
STORED
$ printf "set thing3 0 300 4\r\n3abc\r\n" | nc localhost 11211
STORED
$ printf "get thing thing1 thing2 thing3\r\n" | nc localhost 11211
VALUE thing1 0 4
1abc
VALUE thing2 0 4
2abc
VALUE thing3 0 4
3abc
END
```

**Description**

Gets the value for the given key. When the key does not exist, a response with just `END\r\n` is given. When multiple keys are provided, only ones that exist will be returned.

### `gets`

[](#gets)

- **Supported:** Yes ✅
- **Format:** `get  [key2 key3 ... keyn]\r\n`
- **Found Response:** `VALUE    \r\n\r\nEND\r\n`
- **Not Found Response:** `END\r\n`

**Examples**

```
$ printf "set thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "gets thing\r\n" | nc localhost 11211
VALUE thing 0 3 1
abc
END
```

```
$ printf "gets thing\r\n" | nc localhost 11211
END
```

**Description**

This is the get command with the addition of the cas token in the response.

### `gat`

[](#gat)

- **Supported:** No ⛔

### `gats`

[](#gats)

- **Supported:** No ⛔

Delete Commands
---------------

[](#delete-commands)

### `delete`

[](#delete)

- **Supported:** Yes ✅
- **Format:** `delete  [noreply]\r\n`
- **Success Response:** `DELETED\r\n`
- **Not Found Response:** `NOT_FOUND\r\n`

**Examples**

```
$ printf "set thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "delete thing\r\n" | nc localhost 11211
DELETED
```

```
$ printf "delete thing\r\n" | nc localhost 11211
NOT_FOUND
```

**Description**

Delete the given key. If the key does not exist then `NOT_FOUND` is returned.

### `flush_all`

[](#flush_all)

- **Supported:** Yes ✅
- **Format:** `flush_all [delay] [noreply]\r\n`
- **Every Response:** `OK\r\n`

**Examples**

```
$ printf "flush_all\r\n" | nc localhost 11211
OK
```

```
$ printf "flush_all\r\n" | nc localhost 11211
OK
$ printf "flush_all\r\n" | nc localhost 11211
OK
```

**Description**

Delete all of the stored keys. There is no fail or error condition, it always returns `OK`.

Arithmetic Commands
-------------------

[](#arithmetic-commands)

### `incr`

[](#incr)

- **Supported:** Yes ✅
- **Format:** `incr   [noreply]\r\n`
- **Success Response:** `\r\n`
- **Error Response:** `CLIENT_ERROR cannot increment or decrement non-numeric value`

**Examples**

```
$ printf "add thing 0 300 1\r\n1\r\n" | nc localhost 11211
STORED
$ printf "incr thing 1\r\n" | nc localhost 11211
2
$ printf "incr thing 1\r\n" | nc localhost 11211
3
```

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "incr thing 1\r\n" | nc localhost 11211
CLIENT_ERROR cannot increment or decrement non-numeric value
```

**Description**

This only works on integer values.

### `decr`

[](#decr)

- **Supported:** Yes ✅
- **Format:** `decr   [noreply]\r\n`
- **Success Response:** `\r\n`
- **Error Response:** `CLIENT_ERROR cannot increment or decrement non-numeric value`

**Examples**

```
$ printf "add thing 0 300 1\r\n9\r\n" | nc localhost 11211
STORED
$ printf "decr thing 1\r\n" | nc localhost 11211
8
$ printf "decr thing 1\r\n" | nc localhost 11211
7
```

```
$ printf "add thing 0 300 3\r\nabc\r\n" | nc localhost 11211
STORED
$ printf "decr thing 1\r\n" | nc localhost 11211
CLIENT_ERROR cannot increment or decrement non-numeric value
```

**Description**

This only works on integer values.

Miscellaneous Commands
----------------------

[](#miscellaneous-commands)

### `quit`

[](#quit)

- **Supported:** Yes ✅
- **Format:** `quit\r\n`
- **Every Response:** ( None )

**Examples**

```
$ printf "quit\r\n" | nc localhost 11211
```

**Description**

This closes the connection to the server. It does not return anything.

### `version`

[](#version)

- **Supported:** Yes ✅
- **Format:** `version\r\n`
- **Every Response:** `VERSION \r\n`

**Examples**

```
$ printf "version\r\n" | nc localhost 11211
VERSION 1.6.12
```

**Description**

Get the version number from the server.

### `verbosity`

[](#verbosity)

- **Supported:** No ⛔

### `stats`

[](#stats)

- **Supported:** Yes ✅
- **Format:** `stats\r\n`
- **Every Response:** `STAT  \r\nEND\r\n`

**Example**

```
$ printf "stats\r\n" | nc localhost 11211
STAT pid 92458
STAT uptime 9
STAT time 1650595977
END
```

**Description**

Stats that are currently supported:

- pid
- uptime
- time
- total\_connections
- curr\_items
- cmd\_
- \_hits
- \_misses

Memcached Resources
-------------------

[](#memcached-resources)

- [Memcached](https://github.com/memcached/memcached), the original.
- [Memcached Protocol.txt](https://github.com/memcached/memcached/blob/master/doc/protocol.txt), general description of the protocols.
- [Twemproxy](https://github.com/twitter/twemproxy), a proxy for Memcached and Redis from Twitter.
- [Twemproxy Memcached Notes](https://github.com/twitter/twemproxy/blob/master/notes/memcache.md), helpful list of of supported Memcached comands in Twemproxy.
- [MySQL Memcached TCP Text Protocol](https://docs.oracle.com/cd/E17952_01/mysql-5.6-en/ha-memcached-interfaces-protocol.html), commands outlined for the MySQL implementation.
- [Memcached Cheat Sheet](https://lzone.de/cheat-sheet/memcached), a list of other Memcached resources and examples.
- [libmemcached-awesome](https://github.com/awesomized/libmemcached), an updated version of the original [libmemcached](https://libmemcached.org/libMemcached.html).
- [memc.rs](https://www.memc.rs/intro), Memcached clone written in Rust, compatible with the binary protocol.
- [memtier\_benchmark](https://github.com/RedisLabs/memtier_benchmark), a Memcached ( and Redis ) benchmarking tool.
- [Expiration Times](https://www.php.net/manual/en/memcached.expiration.php), good description of how Memcached treats the expiration times.

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Total

3

Last Release

1550d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/139972?v=4)[Joseph Scott](/maintainers/josephscott)[@josephscott](https://github.com/josephscott)

---

Top Contributors

[![josephscott](https://avatars.githubusercontent.com/u/139972?v=4)](https://github.com/josephscott "josephscott (331 commits)")[![joanhey](https://avatars.githubusercontent.com/u/249085?v=4)](https://github.com/joanhey "joanhey (35 commits)")

---

Tags

memcachedmemcached-server

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/josephscott-marmerine/health.svg)

```
[![Health](https://phpackages.com/badges/josephscott-marmerine/health.svg)](https://phpackages.com/packages/josephscott-marmerine)
```

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

1.1k102.1k151](/packages/nativephp-mobile)[workerman/webman-framework

High performance HTTP Service Framework.

145372.0k298](/packages/workerman-webman-framework)[workerman/http-client

5687.9k28](/packages/workerman-http-client)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[webman/openai

OpenAI client for webman or workerman

714.7k](/packages/webman-openai)[chubbyphp/chubbyphp-workerman-request-handler

A request handler adapter for workerman, using PSR-7, PSR-15 and PSR-17.

1411.8k](/packages/chubbyphp-chubbyphp-workerman-request-handler)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
