friendsofhyperf / once
A magic memoization function for Hyperf.
v3.1.1
2023-12-02 16:49 UTC
Requires
- hyperf/di: ~3.1.0
- hyperf/tappable: ~3.1.0
- spatie/once: ^3.0
Suggests
- hyperf/cache: Require this component for driver 'file'.
- hyperf/db-connection: Require this component for driver 'database'.
- hyperf/redis: Require this component for driver 'redis'.
This package is auto-updated.
Last update: 2024-12-04 08:52:36 UTC
README
A magic memoization function for Hyperf.
Installation
- Installation
composer require friendsofhyperf/once
Documentation
Usage
use FriendsOfHyperf\Once\Annotation\Forget; use FriendsOfHyperf\Once\Annotation\Once; class Foo { #[Once] public function getNumber(): int { return rand(1, 10000); } #[Forget] public function forgetNumber() { } }