src/Domains/Word/Domain/Service/WordCacheService.php line 24

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domains\Word\Domain\Service;
  4. use App\Domains\Word\Infrastructure\Repository\WordCacheRepository;
  5. class WordCacheService
  6. {
  7.     public function __construct(
  8.         private readonly WordCacheRepository $wordCacheRepository,
  9.     ) {
  10.     }
  11.     public function cacheWord(
  12.         array $wordArray,
  13.         int $userId,
  14.         int $ttl 3600,
  15.     ): void {
  16.         $this->wordCacheRepository->cacheWord($wordArray$userId$ttl);
  17.     }
  18.     public function getWord(
  19.         string $wordText,
  20.         string $fromLang,
  21.         string $toLang,
  22.         int $userId,
  23.     ): array|null {
  24.         return $this->wordCacheRepository->getWord($wordText$fromLang$toLang$userId);
  25.     }
  26. }