APICronStoreMemory class
An in-memory APICronStore: for a single instance (and tests). Not shared between processes.
It keeps copies of the runs and locks, like a database: a run or lock returned is not changed by another scheduler using the same store.
- Inheritance
-
- Object
- APICronStore
- APICronStoreMemory
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
acquireLock(
String job, String owner, Duration lease, {DateTime? now}) → APICronJobLock? -
Acquires the lock of
jobforowneruntilnow+lease:nullif another owner holds it (not expired). An expired lock is taken over; a lock ofowneris renewed.override -
claimRun(
APICronJobRun run) → APICronJobRun? -
Inserts
run, claiming its occurrence:nullif the occurrence already has a run (another instance claimed it).override -
deleteRunsBefore(
String job, DateTime before) → int -
Deletes the finished runs of
jobscheduled beforebefore(never a APICronRunStatus.running one: it may be resumed). Returns the count.override -
getLock(
String job) → APICronJobLock? -
The lock of
job, if any.override -
getRun(
String job, DateTime scheduledAt) → APICronJobRun? -
The run of the occurrence
scheduledAtofjob, if any.override -
lastRun(
String job) → APICronJobRun? -
The run of
jobwith the latest APICronJobRun.scheduledAt.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
releaseLock(
APICronJobLock lock) → bool -
Releases
lock(only if still held by its owner).override -
renewLock(
APICronJobLock lock, Duration lease, {DateTime? now}) → bool -
Renews
lockuntilnow+lease:falseif it's no longer held by its owner (lost: expired and taken over).override -
selectRunningRuns(
String job) → List< APICronJobRun> -
The runs of
jobwith status APICronRunStatus.running.override -
selectRuns(
String job, {int limit = 20}) → List< APICronJobRun> -
The latest runs of
job(latest first), at mostlimit.override -
toString(
) → String -
A string representation of this object.
inherited
-
updateRun(
APICronJobRun run, {String? previousOwner}) → bool -
Updates the stored
run, only if the stored one is still APICronRunStatus.running and owned bypreviousOwner(default: the APICronJobRun.owner ofrun; another owner when taking an interrupted run over).falseotherwise: the run was taken over by another instance, finished or deleted, and must not be overwritten.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited