trying to get that cache thingi work

This commit is contained in:
2024-09-13 02:23:17 +02:00
parent b1452c4011
commit 6c608c5d00
2 changed files with 3 additions and 4 deletions

View File

@@ -6,7 +6,6 @@ use Redmine\Client\Psr18Client;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory as GuzzleHttpFactory;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
final class RedmineClient
{
@@ -15,8 +14,7 @@ final class RedmineClient
private ?string $apiKey = null;
public function __construct(
#[Autowire(service: 'redmine_api_cache_pool')]
private TagAwareCacheInterface $redmineApiCachePool
private TagAwareCacheInterface $cache
) {}
public function setUrl(string $url): self
@@ -33,7 +31,7 @@ final class RedmineClient
{
$cacheKey = sprintf('%s_%s_%s', $api, $method, sha1(serialize($arguments)));
return $this->redmineApiCachePool->get($cacheKey, function (ItemInterface $item): string {
return $this->cache->get($cacheKey, function (ItemInterface $item): string {
$item->expiresAfter(3600);
$item->tag([$api, $method]);