A magic memoization function for Hyperf.

v3.1.1 2023-12-02 16:49 UTC

README

Latest Stable Version Total Downloads GitHub license

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()
    {
    }
}

Donate

If you like them, Buy me a cup of coffee. Alipay | WeChat

Contact

License

MIT