PHPackages                             lss/yacache - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. lss/yacache

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

lss/yacache
===========

Lightweight Cache (PSR-16 compatible)

1.2.0(5y ago)015MITPHPPHP ^7.4|^8.0

Since Oct 19Pushed 5y ago2 watchersCompare

[ Source](https://github.com/pavarnos/YACache)[ Packagist](https://packagist.org/packages/lss/yacache)[ Docs](https://github.com/pavarnos/YACache)[ RSS](/packages/lss-yacache/feed)WikiDiscussions main Synced 1mo ago

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

YACache: Yet Another Cache
==========================

[](#yacache-yet-another-cache)

A minimal PSR16 compatible cache library for PHP 7.4+

The goals of this project are

- Minimalism: as little code as possible, only the barest necessary features, as few dependencies as possible.
- Performance: Strips out all but essential features in the main execution flow so that it runs really fast.
- (almost) Standards Compliance: [PSR-16](https://www.php-fig.org/psr/psr-16/) does not have strict typing (yet!?). The `CacheInterface` is mostly duck-type compatible with PSR-16 (No support for DateInterval $ttl)
- adds some tiny and optional utility functions to ease API development eg `increment()` for rate limiters, `remember()` to remove boilerplate lines of code
- Quality: 100% unit test coverage, phpstan max strict, strict\_types=1

Why another cache when there are already so many that are very good?

-  is lean and clean but has extra tools for Packing (serialisation)
-  has tons of drivers, but an extra layer of indirection (`do*` methods)
- many other caches (eg ) work with [PSR-6](https://www.php-fig.org/psr/psr-6/) (which is very heavy) and then add adapters / wrappers for PSR-16 on top
- ... or their code has stampede protection or other clever but complicated things which are awesome for bigger projects (with more traffic) but way overkill for small stuff.

Pull requests welcome, but bear in mind the above project goals. If you have more complex needs, the other (better written, better supported, more mature) projects mentioned above will be a better choice for you.

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

[](#installation)

```
composer require LSS\YACache

```

How to use
==========

[](#how-to-use)

```
use LSS\YACache\RedisCache;

$redis = new \Redis('127.0.0.1');
$cache = new RedisCache($redis);
$value = $cache->remember('another key', 100, function () use ($database) { return $database->someExpensiveQueryResult(); });
```

Browse the `/src` directory for more drivers

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

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

Total

3

Last Release

1990d ago

PHP version history (2 changes)v1.0.0PHP ^7.4

1.2.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b01be5b996fa22f6e49ed9a1d3c55c44b883de66e4ee6ec8acdc4b51fc3697f?d=identicon)[pavarnos](/maintainers/pavarnos)

---

Top Contributors

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

---

Tags

containerPSR-11dependency-injection

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lss-yacache/health.svg)

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[slince/di

A flexible dependency injection container

20260.4k6](/packages/slince-di)[phpwatch/simple-container

A fast and minimal PSR-11 compatible Dependency Injection Container with array-syntax and without auto-wiring

1810.1k2](/packages/phpwatch-simple-container)

PHPackages © 2026

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