-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
353dc2b
commit 7854f56
Showing
11 changed files
with
183 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
docs/pages/docs/features/security/oauth2/persistent-data/doctrine.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
collections: | ||
- documents | ||
layout: dm:document | ||
parent: docs/features/timers/index | ||
title: CRON | ||
description: > | ||
Learn how to schedule tasks with CRON notation. | ||
--- | ||
|
||
# CRON | ||
|
||
## Usage | ||
|
||
### Running Scheduler | ||
|
||
You need to invoke the `cron` command: | ||
|
||
```php | ||
$ php bin/resonance.php cron | ||
``` | ||
|
||
That command should be a long-running processs, it *MUST NOT* be executed every | ||
minute, because Resonance has it's own built-in CRON scheduler. | ||
|
||
### Implementing CRON Jobs | ||
|
||
Your class has to implement `CronJobInterface` (or extend `CronJob`) and have | ||
`ScheduledWithCron` attribute. | ||
|
||
It also needs to belong to the `CronJob` collection. | ||
|
||
For example: | ||
|
||
```php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Distantmagic\Resonance\Attribute\ScheduledWithCron; | ||
use Distantmagic\Resonance\Attribute\Singleton; | ||
use Distantmagic\Resonance\CronJob; | ||
use Distantmagic\Resonance\SingletonCollection; | ||
|
||
#[ScheduledWithCron('* * * * *')] | ||
#[Singleton(collection: SingletonCollection::CronJob)] | ||
readonly class EveryMinute extends CronJob | ||
{ | ||
public function onCronTick(): void | ||
{ | ||
swoole_error_log(SWOOLE_LOG_DEBUG, 'minute passed'); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
collections: | ||
- documents | ||
layout: dm:document | ||
parent: docs/features/index | ||
title: Timers | ||
description: > | ||
Learn how to schedule cyclical tasks. | ||
--- | ||
|
||
# Timers | ||
|
||
{{docs/features/timers/*/index}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
collections: | ||
- documents | ||
layout: dm:document | ||
parent: docs/features/timers/index | ||
title: Tick Timer | ||
description: > | ||
Learn how to schedule tasks that trigger every N seconds. | ||
--- | ||
|
||
# Tick Timer | ||
|
||
## Usage | ||
|
||
For example: | ||
|
||
```php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Distantmagic\Resonance\Attribute\ScheduledWithTickTimer; | ||
use Distantmagic\Resonance\Attribute\Singleton; | ||
use Distantmagic\Resonance\TickTimerJobInterface; | ||
use Distantmagic\Resonance\SingletonCollection; | ||
|
||
#[ScheduledWithTickTimer(5)] | ||
#[Singleton(collection: SingletonCollection::TickTimerJob)] | ||
readonly class EveryFiveSeconds extends TickTimerJobInterface | ||
{ | ||
public function onTimerTick(): void | ||
{ | ||
swoole_error_log(SWOOLE_LOG_DEBUG, '5 seconds passed'); | ||
} | ||
|
||
public function shouldRegister(): bool | ||
{ | ||
return true; | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters