PHP code example of morimorim / laravel-cache-attr

1. Go to this page and download the library: Download morimorim/laravel-cache-attr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

morimorim / laravel-cache-attr example snippets


use Laravel\Cache\Attribute\Cacheable;

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