generated from wayofdev/laravel-package-tpl
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add integration with cache, sessions, queue
- Loading branch information
Showing
25 changed files
with
653 additions
and
63 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
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 @@ | ||
# Cache |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Queue |
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 @@ | ||
# Sessions |
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,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace WayOfDev\Cycle\Bridge\Cache\Entities; | ||
|
||
use Cycle\Annotated\Annotation\Column; | ||
use Cycle\Annotated\Annotation\Entity; | ||
|
||
#[Entity(table: 'cache')] | ||
class Cache | ||
{ | ||
#[Column(type: 'string', primary: true)] | ||
public string $key; | ||
|
||
#[Column(type: 'longText')] | ||
public string $text; | ||
|
||
#[Column(type: 'integer')] | ||
public int $expiration; | ||
} |
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,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace WayOfDev\Cycle\Bridge\Cache\Entities; | ||
|
||
use Cycle\Annotated\Annotation\Column; | ||
use Cycle\Annotated\Annotation\Entity; | ||
|
||
#[Entity(table: 'cache_locks')] | ||
class CacheLock | ||
{ | ||
#[Column(type: 'string', primary: true)] | ||
public string $key; | ||
|
||
#[Column(type: 'string')] | ||
public string $owner; | ||
|
||
#[Column(type: 'integer')] | ||
public int $expiration; | ||
} |
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace WayOfDev\Cycle\Bridge\Cache\Providers; | ||
|
||
use Illuminate\Config\Repository; | ||
use Illuminate\Support\ServiceProvider; | ||
use Psr\Container\ContainerExceptionInterface; | ||
use Psr\Container\NotFoundExceptionInterface; | ||
|
||
use function array_merge; | ||
|
||
class CacheServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* @throws ContainerExceptionInterface | ||
* @throws NotFoundExceptionInterface | ||
*/ | ||
public function register(): void | ||
{ | ||
/** @var Repository $config */ | ||
$config = $this->app->get(Repository::class); | ||
|
||
$config->set('cycle.tokenizer.directories', array_merge( | ||
$config->get('cycle.tokenizer.directories', []), | ||
[__DIR__ . '/../Entities'] | ||
)); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace WayOfDev\Cycle\Bridge\Queue\Entities; | ||
|
||
use Cycle\Annotated\Annotation\Column; | ||
use Cycle\Annotated\Annotation\Entity; | ||
use Cycle\Annotated\Annotation\Table\Index; | ||
use DateTimeImmutable; | ||
|
||
#[Index(columns: ['uuid'], unique: true)] | ||
#[Entity(table: 'failed_jobs')] | ||
class FailedJob | ||
{ | ||
#[Column(type: 'primary')] | ||
public int $id; | ||
|
||
#[Column(type: 'string')] | ||
public string $uuid; | ||
|
||
#[Column(type: 'text')] | ||
public string $connection; | ||
|
||
#[Column(type: 'text')] | ||
public string $queue; | ||
|
||
#[Column(type: 'longText')] | ||
public string $payload; | ||
|
||
#[Column(type: 'longText')] | ||
public string $exception; | ||
|
||
#[Column(type: 'datetime', default: 'CURRENT_TIMESTAMP')] | ||
public DateTimeImmutable $failedAt; | ||
} |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace WayOfDev\Cycle\Bridge\Queue\Entities; | ||
|
||
use Cycle\Annotated\Annotation\Column; | ||
use Cycle\Annotated\Annotation\Entity; | ||
use Cycle\Annotated\Annotation\Table\Index; | ||
|
||
#[Index(columns: ['queue'])] | ||
#[Entity(table: 'jobs')] | ||
class Job | ||
{ | ||
#[Column(type: 'primary')] | ||
public int $id; | ||
|
||
#[Column(type: 'string')] | ||
public string $queue; | ||
|
||
#[Column(type: 'longText')] | ||
public string $payload; | ||
|
||
#[Column(type: 'tinyInteger', unsigned: true)] | ||
public int $attempts; | ||
|
||
#[Column(type: 'timestamp', nullable: true)] | ||
public ?int $reservedAt; | ||
|
||
#[Column(type: 'timestamp')] | ||
public int $availableAt; | ||
|
||
#[Column(type: 'timestamp')] | ||
public int $createdAt; | ||
} |
Oops, something went wrong.