class RedisQueue extends RedisQueue

Traits

Constants

DEFAULT_RETRY_AFTER

DEFAULT_MIGRATION_BATCH_SIZE

LAST_PUSHED_CONTEXT_KEY

Properties

protected Container $container

The IoC container instance.

from  Queue
protected string $connectionName

The connection name for the queue.

from  Queue
protected array $config

The original configuration for the queue.

from  Queue
protected bool $dispatchAfterCommit

Indicates that jobs should be dispatched after the open parent database transactions have committed.

from  Queue
protected null|Queue): mixed): mixed $afterCommitDispatcher

Dispatch an after-commit operation through its live queue owner.

from  Queue
static protected callable[] $createPayloadCallbacks

The create payload callbacks.

from  Queue
protected bool $secondaryQueueHadJob

Indicates if a secondary queue had a job available between checks of the primary queue.

from  RedisQueue
protected bool|null $isCluster

Indicates if the connection is a Redis Cluster connection.

from  RedisQueue

Methods

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

mixed
extractAttributeValue(object $instance)

Extract the value from an attribute instance.

object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

string|null
resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)

Resolve the default connection name for a given queueable instance.

string|null
resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

queueRoutes()

Get the queue routes manager instance.

queueRoutesContainer()

Get the container that owns the queue routes.

mixed
pushOn(UnitEnum|string|null $queue, object|string $job, mixed $data = '')

Push a new job onto the queue.

from  Queue
mixed
laterOn(UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '')

Push a new job onto a specific queue after (n) seconds.

from  Queue
mixed
bulk(array $jobs, mixed $data = '', UnitEnum|string|null $queue = null)

Push an array of jobs onto the queue.

mixed
getJobDelay(object|string $job)

Get the delay configured on the given job.

from  Queue
string
createPayload(array|object|string $job, string|null $queue, mixed $data = '', DateInterval|DateTimeInterface|int|null $delay = null)

Create a payload string from the given job and data.

from  Queue
array
createPayloadArray(array|object|string $job, string|null $queue, mixed $data = '')

Create a payload string from the given job and data.

array
createObjectPayload(object $job, string|null $queue)

Create a payload for an object-based queue handler.

from  Queue
string
getDisplayName(object $job)

Get the display name for the given job.

from  Queue
mixed
getJobTries(mixed $job)

Get the maximum number of attempts for an object-based queue handler.

from  Queue
mixed
getJobBackoff(mixed $job)

Get the backoff for an object-based queue handler.

from  Queue
mixed
getJobExpiration(mixed $job)

Get the expiration timestamp for an object-based queue handler.

from  Queue
bool
jobShouldBeEncrypted(object $job)

Determine if the job should be encrypted.

from  Queue
array
createStringPayload(array|string $job, string|null $queue, mixed $data)

Create a typical, string based queue payload array.

from  Queue
static void
createPayloadUsing(callable|null $callback)

Register a callback to be executed when creating job payloads.

from  Queue
array
withCreatePayloadHooks(string|null $queue, array $payload)

Create the given payload using any registered payload hooks.

from  Queue
setAfterCommitDispatcher(Closure|null $dispatcher)

Set the dispatcher for after-commit queue operations.

from  Queue
mixed
enqueueUsing(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job using the given callback.

from  Queue
void
deferEnqueueAfterCommit(DatabaseTransactionsManager $transactions, object|string $job, Closure $enqueue)

Defer an enqueue operation until the applicable transaction commits.

from  Queue
void
deferBatchEnqueueAfterCommit(DatabaseTransactionsManager $transactions, array $jobs, Closure $enqueue)

Defer a batch enqueue operation until the applicable transaction commits.

from  Queue
mixed
enqueueNow(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job immediately using the given callback.

from  Queue
string
finalizePayloadForQueueing(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Finalize an encoded payload immediately before queueing.

from  Queue
array
partitionJobsByAfterCommit(array $jobs, DatabaseTransactionsManager|null $transactions)

Partition jobs by whether they should be deferred until the active transaction commits.

from  Queue
bool
shouldDispatchAfterCommit(object|string $job)

Determine if the job should be dispatched after the open parent database transactions have committed.

from  Queue
void
addJobRollbackCallback(DatabaseTransactionsManager $transactions, object|string $job)

Register a transaction rollback callback that releases the job's locks.

from  Queue
Closure|null
createJobRollbackCallback(object|string $job)

Create a callback that releases the job's locks.

from  Queue
void
acceptDispatchLocks(object|string $job)

Mark a job's dispatch locks as accepted by the queue.

from  Queue
void
raiseJobQueueingEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queueing event.

from  Queue
void
raiseJobQueueingFailedEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay, Throwable $exception)

Raise the job queueing failed event.

from  Queue
void
raiseJobQueuedEvent(string|null $queue, mixed $jobId, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queued event.

from  Queue
string|null
normalizeQueue(UnitEnum|string|null $queue)

Normalize an enum queue name without applying defaults or forwarding.

from  Queue
string
resolveQueue(string $queue)

Get the routed queue name for the given queue.

from  Queue
string
getConnectionName()

Get the connection name for the queue.

from  Queue
setConnectionName(string $name)

Set the connection name for the queue.

from  Queue
array
getConfig()

Get the queue configuration array.

from  Queue
setConfig(array $config)

Set the queue configuration array.

from  Queue
getContainer()

Get the container instance being used by the connection.

from  Queue
setContainer(Container $container)

Set the IoC container instance.

from  Queue
static void
flushState()

Flush all static state.

from  Queue
__construct(Factory $redis, string $default = 'default', string|null $connection = null, int|null $retryAfter = self::DEFAULT_RETRY_AFTER, int|null $blockFor = null, bool $dispatchAfterCommit = false, int $migrationBatchSize = self::DEFAULT_MIGRATION_BATCH_SIZE)

Create a new Redis queue instance.

int
size(UnitEnum|string|null $queue = null)

Get the size of the queue.

int
pendingSize(UnitEnum|string|null $queue = null)

Get the number of pending jobs.

int
delayedSize(UnitEnum|string|null $queue = null)

Get the number of delayed jobs.

int
reservedSize(UnitEnum|string|null $queue = null)

Get the number of reserved jobs.

int
totalSize()

Get the number of jobs across every queue.

int
totalPendingSize()

Get the number of pending jobs across every queue.

int
totalDelayedSize()

Get the number of delayed jobs across every queue.

int
totalReservedSize()

Get the number of reserved jobs across every queue.

pendingJobs(UnitEnum|string|null $queue = null)

Get the pending jobs for the given queue.

delayedJobs(UnitEnum|string|null $queue = null)

Get the delayed jobs for the given queue.

reservedJobs(UnitEnum|string|null $queue = null)

Get the reserved jobs for the given queue.

allPendingJobs()

Get all pending jobs across every queue.

allDelayedJobs()

Get all delayed jobs across every queue.

allReservedJobs()

Get all reserved jobs across every queue.

allQueueNames()

Get the unique queue names.

allQueueNamesUsing(RedisConnection $connection)

Get the unique queue names using an already-held raw connection.

inspectJobs(UnitEnum|string|null $queue, string $suffix = '')

Inspect jobs from one queue while holding one Redis connection.

inspectAllQueues(string $suffix = '')

Inspect jobs across every queue while holding one Redis connection.

inspectJobsUsing(RedisConnection $connection, string $name, string $suffix)

Inspect one Redis queue using an already-held raw connection.

inspectJobsAtKey(RedisConnection $connection, string $key, string $name, string $suffix)

Inspect a formatted storage key while retaining the requested queue identity.

int|null
creationTimeOfOldestPendingJob(UnitEnum|string|null $queue = null)

Get the creation timestamp of the oldest pending job, excluding delayed jobs.

array
prepareBatchJobs(array $jobs, mixed $data, string|null $queue)

Prepare the payload and delay for each of the given jobs.

void
enqueueBatch(array $jobs, string|null $queue)

Store a prepared batch and raise its queue lifecycle events.

string
preparePayloadForBulk(object|string $job, string $payload, string|null $queue)

Prepare a payload for bulk storage.

void
handlePayloadPushedInBulk(string $payload, string|null $queue)

Handle a payload that was stored as part of a batch.

mixed
push(object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue.

mixed
pushRaw(string $payload, UnitEnum|string|null $queue = null, array $options = [])

Push a raw payload onto the queue.

mixed
later(DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue after a delay.

mixed
laterRaw(DateInterval|DateTimeInterface|int $delay, string $payload, string|null $queue = null)

Push a raw job onto the queue after (n) seconds.

Job|null
pop(UnitEnum|string|null $queue = null, int $index = 0)

Pop the next job off of the queue.

void
migrate(string $queue)

Migrate any delayed or expired jobs onto the primary queue.

array
migrateExpiredJobs(string $from, string $to)

Migrate the delayed jobs that are ready to the regular queue.

array
retrieveNextJob(string $queue, bool $block = true)

Retrieve the next job from the queue.

void
deleteReserved(string $queue, RedisJob $job)

Delete a reserved job from the queue.

void
deleteAndRelease(string $queue, RedisJob $job, DateInterval|DateTimeInterface|int $delay)

Delete a reserved job from the reserved queue and release it.

int
clear(UnitEnum|string|null $queue = null)

Delete all of the jobs from the queue.

string
getRandomId()

Get a random ID string.

string
getQueue(UnitEnum|string|null $queue)

Get the queue or return the default.

string
getQueueRedisKey(UnitEnum|string|null $queue = null)

Get the cluster-safe Redis key for the given queue.

string
formatQueueRedisKey(string $queue)

Format a physical queue name as a cluster-safe Redis key.

bool
isClusterConnection()

Determine if the queue connection is a Redis Cluster connection.

getConnection()

Get the connection for the queue.

getRedis()

Get the underlying Redis instance.

int
readyNow(UnitEnum|string|null $queue = null)

Get the number of queue jobs that are ready to process.

void
event(string $queue, mixed $event)

Fire the given event if a dispatcher is bound.

bool
hasEventListeners(string $event)

Determine if the given Horizon event has listeners.

void
setLastPushed(object|string $job)

Set the job that last pushed to queue via the "push" method.

Details

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

in InteractsWithTime at line 47
protected DateTimeInterface|int parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 63
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

in InteractsWithTime at line 71
protected string runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

Parameters

float $startTime
float|null $endTime

Return Value

string

protected mixed getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

Parameters

object $target
string $attributeClass
string|null $property
mixed $default

Return Value

mixed

protected mixed extractAttributeValue(object $instance)

Extract the value from an attribute instance.

Parameters

object $instance

Return Value

mixed

protected object|null getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

Parameters

object $target
string $attributeClass
ReflectionClass|null $declaringClass

Return Value

object|null

protected bool propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

Parameters

object $target
ReflectionClass $reflection
string|null $property
ReflectionClass $attributeDeclaringClass

Return Value

bool

string|null resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)

Resolve the default connection name for a given queueable instance.

Parameters

object $queueable
UnitEnum|string|null $queue

the caller-selected queue, overriding the queueable's queue when resolving a forwarded connection

Return Value

string|null

string|null resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

Parameters

object $queueable

Return Value

string|null

protected QueueRoutes queueRoutes()

Get the queue routes manager instance.

Return Value

QueueRoutes

protected Container queueRoutesContainer()

Get the container that owns the queue routes.

Return Value

Container

in Queue at line 89
mixed pushOn(UnitEnum|string|null $queue, object|string $job, mixed $data = '')

Push a new job onto the queue.

Parameters

UnitEnum|string|null $queue
object|string $job
mixed $data

Return Value

mixed

in Queue at line 97
mixed laterOn(UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '')

Push a new job onto a specific queue after (n) seconds.

Parameters

UnitEnum|string|null $queue
DateInterval|DateTimeInterface|int $delay
object|string $job
mixed $data

Return Value

mixed

in RedisQueue at line 345
mixed bulk(array $jobs, mixed $data = '', UnitEnum|string|null $queue = null)

Push an array of jobs onto the queue.

Parameters

array $jobs
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

in Queue at line 125
protected mixed getJobDelay(object|string $job)

Get the delay configured on the given job.

Parameters

object|string $job

Return Value

mixed

in Queue at line 139
protected string createPayload(array|object|string $job, string|null $queue, mixed $data = '', DateInterval|DateTimeInterface|int|null $delay = null)

Create a payload string from the given job and data.

Parameters

array|object|string $job
string|null $queue
mixed $data
DateInterval|DateTimeInterface|int|null $delay

Return Value

string

Exceptions

InvalidPayloadException

at line 89
protected array createPayloadArray(array|object|string $job, string|null $queue, mixed $data = '')

Create a payload string from the given job and data.

Parameters

array|object|string $job
string|null $queue
mixed $data

Return Value

array

in Queue at line 184
protected array createObjectPayload(object $job, string|null $queue)

Create a payload for an object-based queue handler.

Parameters

object $job
string|null $queue

Return Value

array

Exceptions

RuntimeException

in Queue at line 252
protected string getDisplayName(object $job)

Get the display name for the given job.

Parameters

object $job

Return Value

string

in Queue at line 262
mixed getJobTries(mixed $job)

Get the maximum number of attempts for an object-based queue handler.

Parameters

mixed $job

Return Value

mixed

in Queue at line 276
mixed getJobBackoff(mixed $job)

Get the backoff for an object-based queue handler.

Parameters

mixed $job

Return Value

mixed

in Queue at line 296
mixed getJobExpiration(mixed $job)

Get the expiration timestamp for an object-based queue handler.

Parameters

mixed $job

Return Value

mixed

in Queue at line 312
protected bool jobShouldBeEncrypted(object $job)

Determine if the job should be encrypted.

Parameters

object $job

Return Value

bool

in Queue at line 324
protected array createStringPayload(array|string $job, string|null $queue, mixed $data)

Create a typical, string based queue payload array.

Parameters

array|string $job
string|null $queue
mixed $data

Return Value

array

in Queue at line 347
static void createPayloadUsing(callable|null $callback)

Register a callback to be executed when creating job payloads.

Boot-only. The callback persists in a static property for the worker lifetime and runs on every subsequent payload creation across all coroutines. Passing null clears the registry.

Parameters

callable|null $callback

Return Value

void

in Queue at line 359
protected array withCreatePayloadHooks(string|null $queue, array $payload)

Create the given payload using any registered payload hooks.

Parameters

string|null $queue
array $payload

Return Value

array

in Queue at line 375
Queue setAfterCommitDispatcher(Closure|null $dispatcher)

Set the dispatcher for after-commit queue operations.

Parameters

Closure|null $dispatcher

Return Value

Queue

in Queue at line 390
protected mixed enqueueUsing(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job using the given callback.

The callback receives the queue that owns the operation first so deferred pooled dispatch never retains a borrowed queue.

Parameters

object|string $job
string $payload
string|null $queue
DateInterval|DateTimeInterface|int|null $delay
callable $callback

Return Value

mixed

in Queue at line 417
protected void deferEnqueueAfterCommit(DatabaseTransactionsManager $transactions, object|string $job, Closure $enqueue)

Defer an enqueue operation until the applicable transaction commits.

Parameters

DatabaseTransactionsManager $transactions
object|string $job
Closure $enqueue

Return Value

void

in Queue at line 431
protected void deferBatchEnqueueAfterCommit(DatabaseTransactionsManager $transactions, array $jobs, Closure $enqueue)

Defer a batch enqueue operation until the applicable transaction commits.

Parameters

DatabaseTransactionsManager $transactions
array $jobs
Closure $enqueue

Return Value

void

in Queue at line 480
protected mixed enqueueNow(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job immediately using the given callback.

Parameters

object|string $job
string $payload
string|null $queue
DateInterval|DateTimeInterface|int|null $delay
callable $callback

Return Value

mixed

in Queue at line 505
protected string finalizePayloadForQueueing(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Finalize an encoded payload immediately before queueing.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay

Return Value

string

in Queue at line 540
protected array partitionJobsByAfterCommit(array $jobs, DatabaseTransactionsManager|null $transactions)

Partition jobs by whether they should be deferred until the active transaction commits.

Parameters

array $jobs
DatabaseTransactionsManager|null $transactions

Return Value

array

in Queue at line 559
protected bool shouldDispatchAfterCommit(object|string $job)

Determine if the job should be dispatched after the open parent database transactions have committed.

Parameters

object|string $job

Return Value

bool

in Queue at line 575
protected void addJobRollbackCallback(DatabaseTransactionsManager $transactions, object|string $job)

Register a transaction rollback callback that releases the job's locks.

Parameters

DatabaseTransactionsManager $transactions
object|string $job

Return Value

void

in Queue at line 587
protected Closure|null createJobRollbackCallback(object|string $job)

Create a callback that releases the job's locks.

Parameters

object|string $job

Return Value

Closure|null

in Queue at line 603
protected void acceptDispatchLocks(object|string $job)

Mark a job's dispatch locks as accepted by the queue.

Parameters

object|string $job

Return Value

void

in Queue at line 615
protected void raiseJobQueueingEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queueing event.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay

Return Value

void

in Queue at line 636
protected void raiseJobQueueingFailedEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay, Throwable $exception)

Raise the job queueing failed event.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay
Throwable $exception

Return Value

void

in Queue at line 657
protected void raiseJobQueuedEvent(string|null $queue, mixed $jobId, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queued event.

Parameters

string|null $queue
mixed $jobId
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay

Return Value

void

in Queue at line 676
protected string|null normalizeQueue(UnitEnum|string|null $queue)

Normalize an enum queue name without applying defaults or forwarding.

Parameters

UnitEnum|string|null $queue

Return Value

string|null

in Queue at line 684
protected string resolveQueue(string $queue)

Get the routed queue name for the given queue.

Parameters

string $queue

Return Value

string

in Queue at line 700
string getConnectionName()

Get the connection name for the queue.

Return Value

string

in Queue at line 712
Queue setConnectionName(string $name)

Set the connection name for the queue.

Boot or tests only. Queue connection instances are cached on QueueManager; runtime use races across coroutines and changes every concurrent dispatch through this connection.

Parameters

string $name

Return Value

Queue

in Queue at line 722
array getConfig()

Get the queue configuration array.

Return Value

array

in Queue at line 734
Queue setConfig(array $config)

Set the queue configuration array.

Boot or tests only. Queue connection instances are cached on QueueManager; runtime use races across coroutines and changes every concurrent dispatch through this connection.

Parameters

array $config

Return Value

Queue

in Queue at line 744
Container getContainer()

Get the container instance being used by the connection.

Return Value

Container

in Queue at line 756
Queue setContainer(Container $container)

Set the IoC container instance.

Boot or tests only. Queue connection instances are cached on QueueManager; runtime use races across coroutines and changes every concurrent dispatch through this connection.

Parameters

Container $container

Return Value

Queue

in Queue at line 766
static void flushState()

Flush all static state.

Return Value

void

in RedisQueue at line 54
__construct(Factory $redis, string $default = 'default', string|null $connection = null, int|null $retryAfter = self::DEFAULT_RETRY_AFTER, int|null $blockFor = null, bool $dispatchAfterCommit = false, int $migrationBatchSize = self::DEFAULT_MIGRATION_BATCH_SIZE)

Create a new Redis queue instance.

Parameters

Factory $redis

the Redis factory implementation

string $default

the connection name

string|null $connection

the connection name

int|null $retryAfter

the expiration time of a job

int|null $blockFor

the maximum number of seconds to block for a job

bool $dispatchAfterCommit
int $migrationBatchSize

The batch size to use when migrating delayed / expired jobs onto the primary queue. Negative values are infinite.

in RedisQueue at line 68
int size(UnitEnum|string|null $queue = null)

Get the size of the queue.

Parameters

UnitEnum|string|null $queue

Return Value

int

in RedisQueue at line 84
int pendingSize(UnitEnum|string|null $queue = null)

Get the number of pending jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

in RedisQueue at line 92
int delayedSize(UnitEnum|string|null $queue = null)

Get the number of delayed jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

in RedisQueue at line 100
int reservedSize(UnitEnum|string|null $queue = null)

Get the number of reserved jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

in RedisQueue at line 108
int totalSize()

Get the number of jobs across every queue.

Return Value

int

in RedisQueue at line 129
int totalPendingSize()

Get the number of pending jobs across every queue.

Return Value

int

in RedisQueue at line 139
int totalDelayedSize()

Get the number of delayed jobs across every queue.

Return Value

int

in RedisQueue at line 149
int totalReservedSize()

Get the number of reserved jobs across every queue.

Return Value

int

in RedisQueue at line 161
Collection pendingJobs(UnitEnum|string|null $queue = null)

Get the pending jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

in RedisQueue at line 171
Collection delayedJobs(UnitEnum|string|null $queue = null)

Get the delayed jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

in RedisQueue at line 181
Collection reservedJobs(UnitEnum|string|null $queue = null)

Get the reserved jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

in RedisQueue at line 191
Collection allPendingJobs()

Get all pending jobs across every queue.

Return Value

Collection

in RedisQueue at line 201
Collection allDelayedJobs()

Get all delayed jobs across every queue.

Return Value

Collection

in RedisQueue at line 211
Collection allReservedJobs()

Get all reserved jobs across every queue.

Return Value

Collection

in RedisQueue at line 221
protected Collection allQueueNames()

Get the unique queue names.

Return Value

Collection

in RedisQueue at line 237
protected Collection allQueueNamesUsing(RedisConnection $connection)

Get the unique queue names using an already-held raw connection.

Parameters

RedisConnection $connection

Return Value

Collection

in RedisQueue at line 270
protected Collection inspectJobs(UnitEnum|string|null $queue, string $suffix = '')

Inspect jobs from one queue while holding one Redis connection.

Parameters

UnitEnum|string|null $queue
string $suffix

Return Value

Collection

in RedisQueue at line 290
protected Collection inspectAllQueues(string $suffix = '')

Inspect jobs across every queue while holding one Redis connection.

Parameters

string $suffix

Return Value

Collection

in RedisQueue at line 305
protected Collection inspectJobsUsing(RedisConnection $connection, string $name, string $suffix)

Inspect one Redis queue using an already-held raw connection.

Parameters

RedisConnection $connection
string $name
string $suffix

Return Value

Collection

in RedisQueue at line 315
protected Collection inspectJobsAtKey(RedisConnection $connection, string $key, string $name, string $suffix)

Inspect a formatted storage key while retaining the requested queue identity.

Parameters

RedisConnection $connection
string $key
string $name
string $suffix

Return Value

Collection

in RedisQueue at line 329
int|null creationTimeOfOldestPendingJob(UnitEnum|string|null $queue = null)

Get the creation timestamp of the oldest pending job, excluding delayed jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int|null

in RedisQueue at line 393
protected array prepareBatchJobs(array $jobs, mixed $data, string|null $queue)

Prepare the payload and delay for each of the given jobs.

Parameters

array $jobs
mixed $data
string|null $queue

Return Value

array

in RedisQueue at line 411
protected void enqueueBatch(array $jobs, string|null $queue)

Store a prepared batch and raise its queue lifecycle events.

Parameters

array $jobs
string|null $queue

Return Value

void

at line 135
protected string preparePayloadForBulk(object|string $job, string $payload, string|null $queue)

Prepare a payload for bulk storage.

Parameters

object|string $job
string $payload
string|null $queue

Return Value

string

at line 150
protected void handlePayloadPushedInBulk(string $payload, string|null $queue)

Handle a payload that was stored as part of a batch.

Parameters

string $payload
string|null $queue

Return Value

void

at line 40
mixed push(object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue.

Parameters

object|string $job
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

at line 62
mixed pushRaw(string $payload, UnitEnum|string|null $queue = null, array $options = [])

Push a raw payload onto the queue.

Parameters

string $payload
UnitEnum|string|null $queue
array $options

Return Value

mixed

at line 102
mixed later(DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue after a delay.

Parameters

DateInterval|DateTimeInterface|int $delay
object|string $job
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

in RedisQueue at line 546
protected mixed laterRaw(DateInterval|DateTimeInterface|int $delay, string $payload, string|null $queue = null)

Push a raw job onto the queue after (n) seconds.

Parameters

DateInterval|DateTimeInterface|int $delay
string $payload
string|null $queue

Return Value

mixed

at line 161
Job|null pop(UnitEnum|string|null $queue = null, int $index = 0)

Pop the next job off of the queue.

Parameters

UnitEnum|string|null $queue
int $index

Return Value

Job|null

in RedisQueue at line 609
protected void migrate(string $queue)

Migrate any delayed or expired jobs onto the primary queue.

Parameters

string $queue

Return Value

void

at line 184
array migrateExpiredJobs(string $from, string $to)

Migrate the delayed jobs that are ready to the regular queue.

Parameters

string $from
string $to

Return Value

array

in RedisQueue at line 639
protected array retrieveNextJob(string $queue, bool $block = true)

Retrieve the next job from the queue.

Parameters

string $queue
bool $block

Return Value

array

at line 197
void deleteReserved(string $queue, RedisJob $job)

Delete a reserved job from the queue.

Parameters

string $queue
RedisJob $job

Return Value

void

at line 218
void deleteAndRelease(string $queue, RedisJob $job, DateInterval|DateTimeInterface|int $delay)

Delete a reserved job from the reserved queue and release it.

Parameters

string $queue
RedisJob $job
DateInterval|DateTimeInterface|int $delay

Return Value

void

in RedisQueue at line 693
int clear(UnitEnum|string|null $queue = null)

Delete all of the jobs from the queue.

Parameters

UnitEnum|string|null $queue

Return Value

int

in RedisQueue at line 711
protected string getRandomId()

Get a random ID string.

Return Value

string

in RedisQueue at line 719
string getQueue(UnitEnum|string|null $queue)

Get the queue or return the default.

Parameters

UnitEnum|string|null $queue

Return Value

string

in RedisQueue at line 731
protected string getQueueRedisKey(UnitEnum|string|null $queue = null)

Get the cluster-safe Redis key for the given queue.

Queue names are forwarded once before adding the storage prefix and hash tag.

Parameters

UnitEnum|string|null $queue

Return Value

string

in RedisQueue at line 744
protected string formatQueueRedisKey(string $queue)

Format a physical queue name as a cluster-safe Redis key.

Redis Cluster requires every key passed to a multi-key Lua script to live on the same hash slot. Only storage keys are hash-tagged here.

Parameters

string $queue

Return Value

string

in RedisQueue at line 754
protected bool isClusterConnection()

Determine if the queue connection is a Redis Cluster connection.

Return Value

bool

in RedisQueue at line 762
RedisProxy getConnection()

Get the connection for the queue.

Return Value

RedisProxy

in RedisQueue at line 770
Factory getRedis()

Get the underlying Redis instance.

Return Value

Factory

at line 32
int readyNow(UnitEnum|string|null $queue = null)

Get the number of queue jobs that are ready to process.

Parameters

UnitEnum|string|null $queue

Return Value

int

at line 239
protected void event(string $queue, mixed $event)

Fire the given event if a dispatcher is bound.

Parameters

string $queue
mixed $event

Return Value

void

at line 253
protected bool hasEventListeners(string $event)

Determine if the given Horizon event has listeners.

Parameters

string $event

Return Value

bool

at line 262
protected void setLastPushed(object|string $job)

Set the job that last pushed to queue via the "push" method.

Parameters

object|string $job

Return Value

void