A magic memoization function for Hyperf.
- Installation
composer require friendsofhyperf/once
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()
{
}
}