morimorim/laravel-cache-attr

0.0.2 2023-12-02 09:18 UTC

This package is auto-updated.

Last update: 2024-05-01 00:10:57 UTC


README

This is package of attributes for Laravel. Supported attributes are here.

See also example.

Install

composer require morimorim/laravel-cache-attr

Usage

Specify attributes like following.

use Laravel\Cache\Attribute\Cacheable;

class ExampleService
{
    #[Cacheable(name: 'ExampleService#heavyProcess', ttl_seconds: 60)]
    public function heavyProcess(int $sleep)
    {
        sleep($sleep);
        return Carbon::now();
    }
}