PHPackages                             alksily/memory - 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. alksily/memory

ActiveLibrary[Caching](/categories/caching)

alksily/memory
==============

Memcache or Redis wrapper

1.1.1(4y ago)04MITPHPPHP &gt;=7.0

Since Mar 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/alksily/memory)[ Packagist](https://packagist.org/packages/alksily/memory)[ Docs](https://github.com/alksily/memory)[ RSS](/packages/alksily-memory/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (8)Used By (0)

Memory Component
================

[](#memory-component)

Work with Key-Value storage via user-friendly interface.

#### Requirements

[](#requirements)

- PHP &gt;= 7.0

#### Supporting

[](#supporting)

- Memcache
- Redis

#### Installation

[](#installation)

Run the following command in the root directory of your web project:

> `composer require Alksily/memory`

### Usage

[](#usage)

Connect to the server

```
Alksily\Memory\Mem::initialize([
    [
        'host'    => 'localhost',
        'port'    => '11211',
        'timeout' => 10,
        // additional can be passed options, server-role and pool name:
        // 'driver' => 'memcache', // or redis
    ]
]);
```

Write data to storage

```
Alksily\Memory\Mem::set('foo', 'bar');
```

Read data form storage

```
Alksily\Memory\Mem::get('foo', /* 'default value' */);

// -- or --

Alksily\Memory\Mem::get('foo', function () {
    // some action, e.g. just return string
    return 'baz';
});
```

#### Get or Set Multiple (like a PSR-16)

[](#get-or-set-multiple-like-a-psr-16)

```
// set rows
Alksily\Memory\Mem::setMultiple([
    'cat:0' => 'Kiki',
    'cat:1' => 'Lucky',
    'dog:0' => 'Bucks',
    'cat:2' => 'Simon',
    'dog:1' => 'Eugene',
    'cat:3' => 'Rocky',
], 3600, 'animal');

// get data
$animals = Alksily\Memory\Mem::getMultiple(['cat:0', 'cat:1', 'dog:0', 'cat:2', 'dog:1', 'cat:3']);

// remove data
Alksily\Memory\Mem::deleteMultiple(['cat:0', 'cat:1', 'dog:0', 'cat:2', 'dog:1', 'cat:3']);
```

#### Tags

[](#tags)

```
// set few rows
Alksily\Memory\Mem::set('cat:0', 'Kiki', 3600, 'animal');
Alksily\Memory\Mem::set('cat:1', 'Lucky', 3600, 'animal');
Alksily\Memory\Mem::set('dog:0', 'Bucks', 3600, 'animal');
Alksily\Memory\Mem::set('cat:2', 'Simon', 3600, 'animal');
Alksily\Memory\Mem::set('dog:1', 'Eugene', 3600, 'animal');
Alksily\Memory\Mem::set('cat:3', 'Rocky', 3600, 'animal');

// get data as array
$animal = Alksily\Memory\Mem::getByTag('animal');

// remove data
Alksily\Memory\Mem::deleteByTag('animal');
```

#### Contributing

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

#### License

[](#license)

The Alksily Memory is licensed under the MIT license. See [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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 ~148 days

Recently: every ~223 days

Total

7

Last Release

1732d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5148853?v=4)[Aleksey Ilyin](/maintainers/alksily)[@alksily](https://github.com/alksily)

---

Top Contributors

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

---

Tags

phppdoredismemorymemcache

### Embed Badge

![Health badge](/badges/alksily-memory/health.svg)

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

###  Alternatives

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[clickalicious/memcached.php

Memcached.php - Plain vanilla PHP Memcached client with full support of Memcached protocol.

2973.7k5](/packages/clickalicious-memcachedphp)[swoft/redis

swoft redis component

12168.4k16](/packages/swoft-redis)[eftec/cacheone

A Cache library with minimum dependency

103.5k4](/packages/eftec-cacheone)[garyr/memento

Lightweight cache library

196.6k1](/packages/garyr-memento)

PHPackages © 2026

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