TaskAdapterInterface
in
Adapter interface
Tags
Table of Contents
Methods
- claimTaskRun() : bool
- Atomically claim a task's current due-window. Returns true if this call claimed $taskId for $window (no other live claim for that same window exists); false if another claim for the same window is already live. A claim for a *different* window from what's currently stored always succeeds immediately, regardless of the old claim's expiry - only a same-window re-claim is blocked, and only until the stored claim's TTL elapses.
- clearTasks() : TaskAdapterInterface
- Clear all scheduled task
- getAllTasks() : array<string|int, mixed>
- Get every scheduled task, keyed by task ID.
- getTask() : Task|null
- Get scheduled task
- getTaskCount() : int
- Get scheduled tasks count
- getTasks() : array<string|int, mixed>
- Get scheduled tasks
- hasTasks() : bool
- Has scheduled tasks
- removeTask() : TaskAdapterInterface
- Remove scheduled task
- schedule() : TaskAdapterInterface
- Schedule job with queue
- updateTask() : TaskAdapterInterface
- Update scheduled task
Methods
claimTaskRun()
Atomically claim a task's current due-window. Returns true if this call claimed $taskId for $window (no other live claim for that same window exists); false if another claim for the same window is already live. A claim for a *different* window from what's currently stored always succeeds immediately, regardless of the old claim's expiry - only a same-window re-claim is blocked, and only until the stored claim's TTL elapses.
public
claimTaskRun(string $taskId, string $window) : bool
Parameters
- $taskId : string
- $window : string
Return values
boolclearTasks()
Clear all scheduled task
public
clearTasks() : TaskAdapterInterface
Return values
TaskAdapterInterfacegetAllTasks()
Get every scheduled task, keyed by task ID.
public
getAllTasks() : array<string|int, mixed>
Exists so callers that want all of them - Queue::getScheduledTasks(), and through it every run() on every tick - can ask for them in one go instead of listing the IDs and then fetching each task individually. That pattern costs a round trip per scheduled task on every backend that has round trips, which is the definition of an N+1.
Any task that can't be loaded (corrupt, tampered, or removed mid-read) is omitted rather than returned as null, matching what callers already did with getTask()'s null.
Return values
array<string|int, mixed> —taskId => Task
getTask()
Get scheduled task
public
getTask(string $taskId) : Task|null
Parameters
- $taskId : string
Return values
Task|nullgetTaskCount()
Get scheduled tasks count
public
getTaskCount() : int
Return values
intgetTasks()
Get scheduled tasks
public
getTasks() : array<string|int, mixed>
Return values
array<string|int, mixed>hasTasks()
Has scheduled tasks
public
hasTasks() : bool
Return values
boolremoveTask()
Remove scheduled task
public
removeTask(string $taskId) : TaskAdapterInterface
Parameters
- $taskId : string
Return values
TaskAdapterInterfaceschedule()
Schedule job with queue
public
schedule(Task $task) : TaskAdapterInterface
Parameters
- $task : Task
Return values
TaskAdapterInterfaceupdateTask()
Update scheduled task
public
updateTask(Task $task) : TaskAdapterInterface
Parameters
- $task : Task