phpyh / lru-memoizer
PHPyh LRU Memoizer
Installs: 1 957
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.14.3
- phpunit/phpunit: ^10.0
- phpyh/coding-standard: ^1.0
- vimeo/psalm: ^5.6
This package is auto-updated.
Last update: 2024-12-21 07:54:07 UTC
README
Installation
composer require phpyh/lru-memoizer
Usage
use PHPyh\LRUMemoizer\LRUMemoizer; final class Metadata {} final class MetadataFactory { public function __construct( private readonly LRUMemoizer $memoizer = new LRUMemoizer(capacity: 25), ) { } /** * @param ?class-string $class */ public function metadataFor(string $class): Metadata { return $this->memoizer->get($class, static fn (): Metadata => new Metadata()); } }