PHPackages                             flatphp/memstore - 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. flatphp/memstore

ActiveLibrary[Caching](/categories/caching)

flatphp/memstore
================

memory storage component

v3.0.1(4y ago)1901MITPHPPHP &gt;=8.0

Since Apr 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/flatphp/memstore)[ Packagist](https://packagist.org/packages/flatphp/memstore)[ RSS](/packages/flatphp-memstore/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (5)Used By (1)

Memstore
========

[](#memstore)

Memcache, Memcached, Redis, RedisCluster, Predis

Installation
============

[](#installation)

```
composer require "flatphp/memstore"
```

Usage
=====

[](#usage)

```
use Flatphp\Memstore\Conn;

// single
Conn::init(array(
    'memcache' => ['host' => '127.0.0.1', 'port' => 11211],
    'memcached' => ['host' => '127.0.0.1', 'port' => 11211],
    'redis' => ['host' => '127.0.0.1', 'port' => '6379'],
    'redis_cluster' => ['seeds' => ['host1:7001', 'host2:7002']],
    'predis' => ['host' => '127.0.0.1', 'port' => '6379'],
));

$memcache = Conn::getMemcache();
$memcached = Conn::getMemcached();
$redis = Conn::getRedis();
$redis_cluster = Conn::getRedisCluster();
$predis = Conn::getPredis();

$redis->set('test', 1);
......
```

Configuration
=============

[](#configuration)

Memcache
--------

[](#memcache)

```
  // single:
  array(
      'host' => '127.0.0.1',  // required
      'port' => 11211,  // required
      'persistent' => true,
      'weight' => 1,
      # 'timeout' => 1,
      # 'retry_interval' => 15,
      # 'status' => true,
      # 'failure_callback' => null
  )

  // multi:
  array(
      array('host' => 'host1', ......),
      array('host' => 'host2', ......)
  )
......
```

Memcached
---------

[](#memcached)

```
  array(
      'options' = [],
      'persistent_id' => 'mc',
      'host' => 'localhost', // required
      'port' => 11211, // required
      'weight' => 0
  )

  array(
      'options' = [],
      'persistent_id' => '',
      array('host' => 'host1', 'port' => 11211, 'weight' => 1),
      array('host' => 'host2', 'port' => 11211, 'weight' => 1)
  )
```

Redis
-----

[](#redis)

```
  array(
      'options' => [],

       'host' => '127.0.0.1',  // required
       'port' => '6379',  // required
       'password' => 'xxx',
       'persistent' => false,
       'database' => 0,
       'timeout' => 0
  )
```

RedisCluster
------------

[](#rediscluster)

```
  array(
      'options' => [],
      //'name' => 'mycluster'
      'seeds' => ['host1:7000', 'host2:7001'] // name or seeds is required
      'timeout' => 0,
      'read_timeout' => 0,
      'persistent' => false
  )
```

Predis
------

[](#predis)

```
  array(
      'options' => [],
       'host' => '127.0.0.1',
       'port' => '6379',
       'password' => 'xxx',
       'persistent' => false,
       'database' => 0,
       'timeout' => 0
  )

  array(
      'options' => [],
      array(
           'host' => '127.0.0.1',
           'port' => '6379',
           'password' => 'xxx',
           'persistent' => false,
           'database' => 0,
           'timeout' => 0
      ),
      array(
           'host' => '127.0.0.1',
           ......
      )
  )
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~589 days

Total

4

Last Release

1563d ago

Major Versions

v1.0.0 → v2.0.12017-04-12

v2.0.1 → v3.0.02022-01-30

PHP version history (2 changes)v1.0.0PHP &gt;=5.5

v3.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3e4d193838370dbe5119947cb84acd917f9e7dd4baf5ed9d0dbc88f26310fa5?d=identicon)[fredyang](/maintainers/fredyang)

---

Top Contributors

[![shukyoo](https://avatars.githubusercontent.com/u/2231396?v=4)](https://github.com/shukyoo "shukyoo (4 commits)")

---

Tags

redispredismemcachedmemcacheredis-clustermemstore

### Embed Badge

![Health badge](/badges/flatphp-memstore/health.svg)

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

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[phpfastcache/phpfastcache

PHP Abstract Cache Class - Reduce your database call using cache system. Phpfastcache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Dynamodb, Firestore, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ravendb, Ssdb, Sqlite, Wincache, Xcache, Zend Data Cache.

2.4k5.0M130](/packages/phpfastcache-phpfastcache)[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[robinn/phpcacheadmin

A web dashboard for your favorite caching system.

4441.1k1](/packages/robinn-phpcacheadmin)[sabre/cache

Simple cache abstraction layer implementing PSR-16

541.2M3](/packages/sabre-cache)[jamescauwelier/psredis

Sentinel client for the popular php redis client

77392.9k5](/packages/jamescauwelier-psredis)

PHPackages © 2026

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