class RedisJobRepository implements JobRepository

Traits

Constants

DEFAULT_RECENT_JOB_RETENTION

DEFAULT_FAILED_JOB_RETENTION

DEFAULT_MONITORED_JOB_RETENTION

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, string|null $connection = null)

Delete pending and reserved jobs for a queue, optionally on one connection.

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 70
__construct(Factory $redis)

Create a new repository instance.

Parameters

Factory $redis

at line 84
string nextJobId()

Get the next job ID that should be assigned.

Return Value

string

at line 92
int totalRecent()

Get the total count of recent jobs.

Return Value

int

at line 100
int totalFailed()

Get the total count of failed jobs.

Return Value

int

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

Get a chunk of recent jobs.

Parameters

int|null $afterIndex

Return Value

Collection

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

Get a chunk of failed jobs.

Parameters

int|null $afterIndex

Return Value

Collection

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

Get a chunk of pending jobs.

Parameters

int|null $afterIndex

Return Value

Collection

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

Get a chunk of completed jobs.

Parameters

int|null $afterIndex

Return Value

Collection

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

Get a chunk of silenced jobs.

Parameters

int|null $afterIndex

Return Value

Collection

at line 148
int countRecent()

Get the count of recent jobs.

Return Value

int

at line 156
int countFailed()

Get the count of failed jobs.

Return Value

int

at line 164
int countPending()

Get the count of pending jobs.

Return Value

int

at line 172
int countCompleted()

Get the count of completed jobs.

Return Value

int

at line 180
int countSilenced()

Get the count of silenced jobs.

Return Value

int

at line 188
int countRecentlyFailed()

Get the count of the recently failed jobs.

Return Value

int

at line 196
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 210
protected int countJobsByType(string $type)

Get the number of jobs in a given type set.

Parameters

string $type

Return Value

int

at line 224
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 239
Collection getJobs(array $ids, mixed $indexFrom = 0)

Retrieve the jobs with the given IDs.

Parameters

array $ids
mixed $indexFrom

Return Value

Collection

at line 257
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 273
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 302
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 320
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 336
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 364
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 384
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 409
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 429
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 441
void deleteMonitored(array $ids)

Delete the given monitored jobs by IDs.

Parameters

array $ids

Return Value

void

at line 453
void trimRecentJobs()

Trim the recent job list.

Return Value

void

at line 492
void trimFailedJobs()

Trim the failed job list.

Return Value

void

at line 504
void trimMonitoredJobs()

Trim the monitored job list.

Return Value

void

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

Find a failed job by ID.

Parameters

string $id

Return Value

stdClass|null

at line 537
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 573
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 581
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 589
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 605
int deleteFailed(string $id)

Delete a failed job by ID.

Parameters

string $id

Return Value

int

at line 615
int purge(string $queue, string|null $connection = null)

Delete pending and reserved jobs for a queue, optionally on one connection.

Parameters

string $queue
string|null $connection

Return Value

int

at line 642
protected RedisProxy connection()

Get the Redis connection instance.

Return Value

RedisProxy