cash/lrucache

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

Maintainers

👁 cash

Package info

github.com/cash/LRUCache

pkg:composer/cash/lrucache

Statistics

Installs: 4 918 813

Dependents: 6

Suggesters: 0

Stars: 36

Open Issues: 0

1.0.0 2013-09-20 18:59 UTC

Requires

  • php: >=5.3.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 4fa4c6834cec59690b43526c4da41d6153026289

  • Cash Costello <cash.costello.woop@gmail.com>

cachelru

This package is not auto-updated.

Last update: 2026-06-16 14:57:02 UTC


README

👁 Build Status

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');