class RedisJobRepository implements JobRepository

Traits

Properties

array $keys

The keys stored on the job hashes.

int $recentFailedJobExpires

The number of minutes until recently failed jobs should be purged.

int $recentJobExpires

The number of minutes until recent jobs should be purged.

int $pendingJobExpires

The number of minutes until pending jobs should be purged.

int $completedJobExpires

The number of minutes until completed and silenced jobs should be purged.

int $failedJobExpires

The number of minutes until failed jobs should be purged.

int $monitoredJobExpires

The number of minutes until monitored jobs should be purged.

Methods

array
pipeline(callable $callback)

Execute commands in a pipeline, falling back to a transaction.

__construct(Factory $redis)

Create a new repository instance.

string
nextJobId()

Get the next job ID that should be assigned.

int
totalRecent()

Get the total count of recent jobs.

int
totalFailed()

Get the total count of failed jobs.

getRecent(int|null $afterIndex = null)

Get a chunk of recent jobs.

getFailed(int|null $afterIndex = null)

Get a chunk of failed jobs.

getPending(int|null $afterIndex = null)

Get a chunk of pending jobs.

getCompleted(int|null $afterIndex = null)

Get a chunk of completed jobs.

getSilenced(int|null $afterIndex = null)

Get a chunk of silenced jobs.

int
countRecent()

Get the count of recent jobs.

int
countFailed()

Get the count of failed jobs.

int
countPending()

Get the count of pending jobs.

int
countCompleted()

Get the count of completed jobs.

int
countSilenced()

Get the count of silenced jobs.

int
countRecentlyFailed()

Get the count of the recently failed jobs.

getJobsByType(string $type, int|null $afterIndex)

Get a chunk of jobs from the given type set.

int
countJobsByType(string $type)

Get the number of jobs in a given type set.

int
minutesForType(string $type)

Get the number of minutes to count for a given type set.

getJobs(array $ids, mixed $indexFrom = 0)

Retrieve the jobs with the given IDs.

indexJobs(Collection $jobs, int $indexFrom)

Index the given jobs from the given index.

void
pushed(string $connection, string $queue, JobPayload $payload)

Insert the job into storage.

void
reserved(string $connection, string $queue, JobPayload $payload)

Mark the job as reserved.

void
released(string $connection, string $queue, JobPayload $payload, int $delay = 0)

Mark the job as released / pending.

void
remember(string $connection, string $queue, JobPayload $payload)

Mark the job as completed and monitored.

void
migrated(string $connection, string $queue, Collection $payloads)

Mark the given jobs as released / pending.

void
completed(JobPayload $payload, bool $failed = false, bool $silenced = false)

Handle the storage of a completed job.

void
updateRetryInformationOnParent(JobPayload $payload, bool $failed)

Update the retry status of a job's parent.

array
updateRetryStatus(JobPayload $payload, array $retries, bool $failed)

Update the retry status of a job in a retry array.

void
deleteMonitored(array $ids)

Delete the given monitored jobs by IDs.

void
trimRecentJobs()

Trim the recent job list.

void
trimFailedJobs()

Trim the failed job list.

void
trimMonitoredJobs()

Trim the monitored job list.

stdClass|null
findFailed(string $id)

Find a failed job by ID.

void
failed(Throwable $exception, string $connection, string $queue, JobPayload $payload)

Mark the job as failed.

void
storeJobReference(mixed $pipe, string $key, JobPayload $payload)

Store the look-up references for a job.

void
removeJobReference(mixed $pipe, string $key, JobPayload $payload)

Remove the look-up references for a job.

void
storeRetryReference(string $id, string $retryId)

Store the retry job ID on the original job record.

int
deleteFailed(string $id)

Delete a failed job by ID.

int
purge(string $queue)

Delete pending and reserved jobs for a queue.

connection()

Get the Redis connection instance.

Details

protected array pipeline(callable $callback)

Execute commands in a pipeline, falling back to a transaction.

Parameters

callable $callback

Return Value

array

at line 64
__construct(Factory $redis)

Create a new repository instance.

Parameters

Factory $redis

at line 78
string nextJobId()

Get the next job ID that should be assigned.

Return Value

string

at line 86
int totalRecent()

Get the total count of recent jobs.

Return Value

int

at line 94
int totalFailed()

Get the total count of failed jobs.

Return Value

int

at line 102
Collection getRecent(int|null $afterIndex = null)

Get a chunk of recent jobs.

Parameters

int|null $afterIndex

Return Value

Collection

at line 110
Collection getFailed(int|null $afterIndex = null)

Get a chunk of failed jobs.

Parameters

int|null $afterIndex

Return Value

Collection

at line 118
Collection getPending(int|null $afterIndex = null)

Get a chunk of pending jobs.

Parameters

int|null $afterIndex

Return Value

Collection

at line 126
Collection getCompleted(int|null $afterIndex = null)

Get a chunk of completed jobs.

Parameters

int|null $afterIndex

Return Value

Collection

at line 134
Collection getSilenced(int|null $afterIndex = null)

Get a chunk of silenced jobs.

Parameters

int|null $afterIndex

Return Value

Collection

at line 142
int countRecent()

Get the count of recent jobs.

Return Value

int

at line 150
int countFailed()

Get the count of failed jobs.

Return Value

int

at line 158
int countPending()

Get the count of pending jobs.

Return Value

int

at line 166
int countCompleted()

Get the count of completed jobs.

Return Value

int

at line 174
int countSilenced()

Get the count of silenced jobs.

Return Value

int

at line 182
int countRecentlyFailed()

Get the count of the recently failed jobs.

Return Value

int

at line 190
protected Collection getJobsByType(string $type, int|null $afterIndex)

Get a chunk of jobs from the given type set.

Parameters

string $type
int|null $afterIndex

Return Value

Collection

at line 204
protected int countJobsByType(string $type)

Get the number of jobs in a given type set.

Parameters

string $type

Return Value

int

at line 218
protected int minutesForType(string $type)

Get the number of minutes to count for a given type set.

Parameters

string $type

Return Value

int

at line 233
Collection getJobs(array $ids, mixed $indexFrom = 0)

Retrieve the jobs with the given IDs.

Parameters

array $ids
mixed $indexFrom

Return Value

Collection

at line 251
protected Collection indexJobs(Collection $jobs, int $indexFrom)

Index the given jobs from the given index.

Parameters

Collection $jobs
int $indexFrom

Return Value

Collection

at line 267
void pushed(string $connection, string $queue, JobPayload $payload)

Insert the job into storage.

Parameters

string $connection
string $queue
JobPayload $payload

Return Value

void

at line 296
void reserved(string $connection, string $queue, JobPayload $payload)

Mark the job as reserved.

Parameters

string $connection
string $queue
JobPayload $payload

Return Value

void

at line 314
void released(string $connection, string $queue, JobPayload $payload, int $delay = 0)

Mark the job as released / pending.

Parameters

string $connection
string $queue
JobPayload $payload
int $delay

Return Value

void

at line 330
void remember(string $connection, string $queue, JobPayload $payload)

Mark the job as completed and monitored.

Parameters

string $connection
string $queue
JobPayload $payload

Return Value

void

at line 358
void migrated(string $connection, string $queue, Collection $payloads)

Mark the given jobs as released / pending.

Parameters

string $connection
string $queue
Collection $payloads

Return Value

void

at line 378
void completed(JobPayload $payload, bool $failed = false, bool $silenced = false)

Handle the storage of a completed job.

Parameters

JobPayload $payload
bool $failed
bool $silenced

Return Value

void

at line 403
protected void updateRetryInformationOnParent(JobPayload $payload, bool $failed)

Update the retry status of a job's parent.

Parameters

JobPayload $payload
bool $failed

Return Value

void

at line 423
protected array updateRetryStatus(JobPayload $payload, array $retries, bool $failed)

Update the retry status of a job in a retry array.

Parameters

JobPayload $payload
array $retries
bool $failed

Return Value

array

at line 435
void deleteMonitored(array $ids)

Delete the given monitored jobs by IDs.

Parameters

array $ids

Return Value

void

at line 447
void trimRecentJobs()

Trim the recent job list.

Return Value

void

at line 485
void trimFailedJobs()

Trim the failed job list.

Return Value

void

at line 497
void trimMonitoredJobs()

Trim the monitored job list.

Return Value

void

at line 509
stdClass|null findFailed(string $id)

Find a failed job by ID.

Parameters

string $id

Return Value

stdClass|null

at line 530
void failed(Throwable $exception, string $connection, string $queue, JobPayload $payload)

Mark the job as failed.

Parameters

Throwable $exception
string $connection
string $queue
JobPayload $payload

Return Value

void

at line 566
protected void storeJobReference(mixed $pipe, string $key, JobPayload $payload)

Store the look-up references for a job.

Parameters

mixed $pipe
string $key
JobPayload $payload

Return Value

void

at line 574
protected void removeJobReference(mixed $pipe, string $key, JobPayload $payload)

Remove the look-up references for a job.

Parameters

mixed $pipe
string $key
JobPayload $payload

Return Value

void

at line 582
void storeRetryReference(string $id, string $retryId)

Store the retry job ID on the original job record.

Parameters

string $id
string $retryId

Return Value

void

at line 598
int deleteFailed(string $id)

Delete a failed job by ID.

Parameters

string $id

Return Value

int

at line 609
int purge(string $queue)

Delete pending and reserved jobs for a queue.

Parameters

string $queue

Return Value

int

at line 635
protected RedisProxy connection()

Get the Redis connection instance.

Return Value

RedisProxy