PHPackages                             silmaralberti/php-cache - 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. silmaralberti/php-cache

ActiveLibrary[Caching](/categories/caching)

silmaralberti/php-cache
=======================

1.1.2(3y ago)2724↓100%1MITPHPPHP ^7.2|^8.0CI failing

Since Aug 8Pushed 3y agoCompare

[ Source](https://github.com/silmar-alberti/PhpCache)[ Packagist](https://packagist.org/packages/silmaralberti/php-cache)[ RSS](/packages/silmaralberti-php-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (8)Used By (0)

PhpCache
========

[](#phpcache)

extensible and flexible php cache lib.

Install to project
==================

[](#install-to-project)

`composer require silmaralberti/php-cache`

Docs
====

[](#docs)

Use example
-----------

[](#use-example)

```
// set redis adapter connection
$redisConnectionParams = [
    'host' => 'host.docker.internal'
];

$serializer = new IgBinaryLib();
$redisAdapter = new RedisAdapter($redisConnectionParams);
$hash = new HashKeyLib();

$testSettings = new PhpCacheSettingsModel(
    $redisAdapter,
    $serializer,
    $hash
);

$phpCache = new PhpCache($testSettings);
$queryContent = [
    'keyA' => 'keyContentA',
    'keyB' => 'keyContentB'
];

$valueContent = [
    'valueA' => 'contentA',
    'valueB' => 'contentB'
];
$valueCount = $phpCache->increase($queryContent, 1);
// $valueCount 1 if first call

$successOnSave = $phpCache->set($queryContent, $valueContent);
// $successOnSave true if success else false

$cachedValueContent = $phpCache->get($queryContent);
// false if not found in cache
// $cachedValueContent is equal $valueContent
```

Serializer Classes
------------------

[](#serializer-classes)

- `IgBinaryLib`
- `DefaultSerializerLib`

Adapter Class
-------------

[](#adapter-class)

- `RedisAdapter`

KeyGenerator Lib
----------------

[](#keygenerator-lib)

- `HashKeyLib`

PhpCache Methods
----------------

[](#phpcache-methods)

### `increase()`

[](#increase)

increment and return key value

### `get()`

[](#get)

load cache data

### `set()`

[](#set)

storage cache data

### `cacheFunction()`

[](#cachefunction)

get response of function from cache or call function and store result on cache

example:

```
$serializer = new IgBinaryLib();
$redisAdapter = new RedisAdapter($redisConnectionParams);
$hash = new HashKeyLib();

$testSettings = new PhpCacheSettingsModel(
    $redisAdapter,
    $serializer,
    $hash
);

$phpCache = new PhpCache($testSettings);

$testValue = 'storedOnCacheValue';

$result = $phpCache->cacheFunction(
    function ($testValue) {
        return $testValue;
    },
    [$testValue],
    'functionExample'
);

echo $result;
// print 'storedOnCacheValue';
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

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

Recently: every ~231 days

Total

6

Last Release

1173d ago

PHP version history (2 changes)1.0.0PHP ^7.2

1.1.2PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c546976528aa641bf49dcdd306a5a45c95c8fd1f7c47af8154f53a12a77eb010?d=identicon)[silmar-alberti](/maintainers/silmar-alberti)

---

Top Contributors

[![silmar-alberti](https://avatars.githubusercontent.com/u/13025631?v=4)](https://github.com/silmar-alberti "silmar-alberti (38 commits)")

---

Tags

cacheig-binaryphpredisrediscacheigbinay

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silmaralberti-php-cache/health.svg)

```
[![Health](https://phpackages.com/badges/silmaralberti-php-cache/health.svg)](https://phpackages.com/packages/silmaralberti-php-cache)
```

###  Alternatives

[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[rediska/rediska

Full-featured PHP client for key-value database Redis

258241.4k1](/packages/rediska-rediska)[cache/redis-adapter

A PSR-6 cache implementation using Redis (PhpRedis). This implementation supports tags

523.9M27](/packages/cache-redis-adapter)[tedivm/stash-bundle

Incorporates the Stash caching library into Symfony.

841.4M16](/packages/tedivm-stash-bundle)[kdyby/redis

Redis storage for Nette Framework

491.6M2](/packages/kdyby-redis)

PHPackages © 2026

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