Skip to content

moririnson/laravel-cache-attr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Cache Attr

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