master

laravel/framework

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

CommandExecuted.php

TLDR

This file defines a class called CommandExecuted in the Illuminate\Redis\Events namespace. The class represents an event that is triggered when a Redis command is executed. It contains properties to store information about the executed command, its parameters, the execution time, the Redis connection instance, and the connection name.

Classes

CommandExecuted

The CommandExecuted class represents an event that is triggered when a Redis command is executed. It has the following properties:

  • command: The Redis command that was executed.
  • parameters: An array of command parameters.
  • time: The number of milliseconds it took to execute the command.
  • connection: The Redis connection instance.
  • connectionName: The name of the Redis connection.

The class has a constructor that accepts the command, parameters, time, and connection instance as arguments.

<?php

namespace Illuminate\Redis\Events;

class CommandExecuted
{
    /**
     * The Redis command that was executed.
     *
     * @var string
     */
    public $command;

    /**
     * The array of command parameters.
     *
     * @var array
     */
    public $parameters;

    /**
     * The number of milliseconds it took to execute the command.
     *
     * @var float
     */
    public $time;

    /**
     * The Redis connection instance.
     *
     * @var \Illuminate\Redis\Connections\Connection
     */
    public $connection;

    /**
     * The Redis connection name.
     *
     * @var string
     */
    public $connectionName;

    /**
     * Create a new event instance.
     *
     * @param  string  $command
     * @param  array  $parameters
     * @param  float|null  $time
     * @param  \Illuminate\Redis\Connections\Connection  $connection
     * @return void
     */
    public function __construct($command, $parameters, $time, $connection)
    {
        $this->time = $time;
        $this->command = $command;
        $this->parameters = $parameters;
        $this->connection = $connection;
        $this->connectionName = $connection->getName();
    }
}