PHPackages                             cash/lrucache - 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. cash/lrucache

ActiveLibrary[Caching](/categories/caching)

cash/lrucache
=============

An efficient memory-based Least Recently Used (LRU) cache

1.0.0(12y ago)354.7M—8.7%25MITPHPPHP &gt;=5.3.0

Since Sep 20Pushed 12y ago3 watchersCompare

[ Source](https://github.com/cash/LRUCache)[ Packagist](https://packagist.org/packages/cash/lrucache)[ Docs](https://github.com/cash/LRUCache)[ RSS](/packages/cash-lrucache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (5)

LRU Cache
=========

[](#lru-cache)

[![Build Status](https://camo.githubusercontent.com/52a5c44f77574bb5b56e4cb2bf0dfe32a2807a5a9105b28807583f7311e7b263/68747470733a2f2f7472617669732d63692e6f72672f636173682f4c525543616368652e706e67)](http://travis-ci.org/cash/LRUCache)

Implements a non-persistent memory-based Least Recently Used cache.

The keys can be integers or strings. The values can be anything. Because this library uses array(), keys that are strings that contain an integer ("7") are cast to an integer. Therefore, there is no difference between the key "7" and the key 7.

```
$cache = new LRUCache(10);
$cache->put('line1', 'roses are red');
$cache->put('line2', 'violets are blue');
$line1 = $cache->get('line1');
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

4623d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/199558?v=4)[Cash Costello](/maintainers/cash)[@cash](https://github.com/cash)

---

Top Contributors

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

---

Tags

cachelru

### Embed Badge

![Health badge](/badges/cash-lrucache/health.svg)

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

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k686.9M1.3k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[lrucache/lrucache

PHP LRU Cache implementation

67117.1k3](/packages/lrucache-lrucache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2512.2M6](/packages/beste-in-memory-cache)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33113.0k](/packages/anahkiasen-flatten)

PHPackages © 2026

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