master

laravel/framework

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

NoLock.php

TLDR

This file contains the NoLock class which is a subclass of the Lock class in the Illuminate\Cache namespace. It defines several methods related to acquiring and releasing locks.

Classes

NoLock

The NoLock class extends the Lock class and provides a simplified implementation of acquiring and releasing locks. It overrides the following methods:

  • acquire(): This method attempts to acquire the lock and always returns true.
  • release(): This method releases the lock and always returns true.
  • forceRelease(): This method forcefully releases the lock, ignoring ownership. It does not return any value.
  • getCurrentOwner(): This method returns the owner value written into the driver for this lock. It is a protected method and cannot be accessed from outside the class.

Note: There are no methods or classes other than NoLock in this file.

<?php

namespace Illuminate\Cache;

class NoLock extends Lock
{
    /**
     * Attempt to acquire the lock.
     *
     * @return bool
     */
    public function acquire()
    {
        return true;
    }

    /**
     * Release the lock.
     *
     * @return bool
     */
    public function release()
    {
        return true;
    }

    /**
     * Releases this lock in disregard of ownership.
     *
     * @return void
     */
    public function forceRelease()
    {
        //
    }

    /**
     * Returns the owner value written into the driver for this lock.
     *
     * @return mixed
     */
    protected function getCurrentOwner()
    {
        return $this->owner;
    }
}