app/Services/HousekeepingService.php
public function deleteOldFiles(Filesystem $filesystem, string $path, int $max_age): void
    {
        $list = $filesystem->listContents($path, true);

        $timestamp = Carbon::now()->unix();

        foreach ($list as $metadata) {
            if ($metadata['timestamp'] ?? $timestamp < $timestamp - $max_age) {
                $this->deleteFileOrFolder($filesystem, $metadata['path']);
            }
        }
    }
public function deleteOldFiles(Filesystem $filesystem, string $path, int $max_age): void
    {
        $list = $filesystem->listContents($path, true);

        $timestamp = Carbon::now()->unix();

        foreach ($list as $metadata) {
            if ($metadata['timestamp'] ?? $timestamp < $timestamp - $max_age) {
                $this->deleteFileOrFolder($filesystem, $metadata['path']);
            }
        }
    }
public function deleteOldFiles ( Filesystem $ filesystem , string $ path , int $ max_age ) : void { $ list = $ filesystem -> listContents ( $ path , true ) ; $ timestamp = Carbon :: now ( ) -> unix ( ) ; foreach ( $ list as $ metadata ) { if ( $ metadata [ 'timestamp' ] ?? $ timestamp < $ timestamp - $ max_age ) { $ this -> deleteFileOrFolder ( $ filesystem , $ metadata [ 'path' ] ) ; } } }
Delete old cache files.

@param Filesystem $filesystem
@param string     $path
@param int        $max_age    Seconds

@return void
Delete old cache files .