master

laravel/framework

Last updated at: 29/12/2023 09:20

FileLock.php

TLDR

The FileLock.php file is a part of the Illuminate\Cache namespace and contains a single class FileLock which extends the CacheLock class. The FileLock class has a single method acquire() which attempts to acquire a lock.

Classes

FileLock

The FileLock class is a subclass of the CacheLock class and is responsible for acquiring locks in the cache. It contains the following methods:

  • acquire(): This method attempts to acquire the lock by using the store object to add the lock to the cache. It returns a boolean indicating whether the lock was successfully acquired.
<?php

namespace Illuminate\Cache;

class FileLock extends CacheLock
{
    /**
     * Attempt to acquire the lock.
     *
     * @return bool
     */
    public function acquire()
    {
        return $this->store->add($this->name, $this->owner, $this->seconds);
    }
}