mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
26 lines
461 B
PHP
26 lines
461 B
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
/**
|
|
* A class to provide strongly typed options about the cache configuration.
|
|
*/
|
|
final class CacheOptions
|
|
{
|
|
private ?int $ttl = null;
|
|
|
|
public function __construct(private readonly JikanConfig $jikanConfig)
|
|
{
|
|
}
|
|
|
|
public function ttl(): int
|
|
{
|
|
return $this->ttl ?? $this->jikanConfig->defaultCacheExpire();
|
|
}
|
|
|
|
public function setTtl(?int $ttl): void
|
|
{
|
|
$this->ttl = $ttl;
|
|
}
|
|
}
|