twistor / lru-cache
LRU cache implementation
v1.0.0
2019-11-18 19:57 UTC
Requires
- php: ^7.2
Requires (Dev)
- infection/infection: ^0.14.2
- phpstan/phpstan: ^0.11.19
- phpstan/phpstan-phpunit: ^0.11.2
- phpstan/phpstan-strict-rules: ^0.11.1
- phpunit/phpunit: ^8.4
- vimeo/psalm: ^3.6
This package is auto-updated.
Last update: 2024-10-19 08:23:55 UTC
README
An LRU (least recently used) cache allows you to keep an in memory cache of objects. The oldest cache items will be removed once the capacity limit is reached.
Installation
composer require twistor/lru-cache
Usage
use Twistor\LruCache; $cache = new LruCache(100); $cache->put('my_key', 1); $cache->get('my_key'); $cache->getWith('new_key', function ($key) { return 2; });