Documentation

TaskAdapterInterface
in

Adapter interface

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
3.0.0

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
bool

getAllTasks()

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

getTasks()

Get scheduled tasks

public getTasks() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results