cache/array-adapter
In-memory PSR-6 and PSR-16 cache pool for tests and short-lived scripts, with tags, hierarchical keys, and an optional item limit. Values last only for the current PHP process.
This package provides in-memory PSR-6 and PSR-16 cache implementations. The pool supports tags and hierarchical keys.
Values live only for the current PHP process. This adapter works well in tests and short-lived scripts.
composer require cache/array-adapter:^3.0
use Cache\Adapter\PHPArray\ArrayCachePool;
$pool = new ArrayCachePool();
Pass a positive maximum item count as the first constructor argument. The default null value keeps every item for the process lifetime.
$pool = new ArrayCachePool(1_000);
When the pool reaches the limit, saving a new key removes the key in the next storage slot. Updating an existing key keeps its slot.
Version 3 stores a generation snapshot with each tagged item and a separate marker for each tag. Array caches are process-local, so new workers start with an empty cache.
Send pull requests to the main repository. Report issues on the GitHub issue tracker.
How can I help you explore Laravel packages today?