master

laravel/framework

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

SchedulingMutex.php

TLDR

This file defines an interface called SchedulingMutex in the Illuminate\Console\Scheduling namespace. The interface contains two methods create and exists for obtaining and determining the existence of a scheduling mutex for an event respectively.

Methods

create

This method attempts to obtain a scheduling mutex for the given event. It takes two parameters:

  • $event (type: \Illuminate\Console\Scheduling\Event): The event for which a scheduling mutex is to be obtained.
  • $time (type: \DateTimeInterface): The time at which the event occurs.

The method returns a boolean value indicating whether the scheduling mutex was successfully obtained.

exists

This method determines if a scheduling mutex exists for the given event. It takes the same parameters as the create method:

  • $event (type: \Illuminate\Console\Scheduling\Event): The event for which the existence of a scheduling mutex is to be determined.
  • $time (type: \DateTimeInterface): The time at which the event occurs.

The method returns a boolean value indicating whether a scheduling mutex exists for the given event.

<?php

namespace Illuminate\Console\Scheduling;

use DateTimeInterface;

interface SchedulingMutex
{
    /**
     * Attempt to obtain a scheduling mutex for the given event.
     *
     * @param  \Illuminate\Console\Scheduling\Event  $event
     * @param  \DateTimeInterface  $time
     * @return bool
     */
    public function create(Event $event, DateTimeInterface $time);

    /**
     * Determine if a scheduling mutex exists for the given event.
     *
     * @param  \Illuminate\Console\Scheduling\Event  $event
     * @param  \DateTimeInterface  $time
     * @return bool
     */
    public function exists(Event $event, DateTimeInterface $time);
}