You've already forked redmine-bundle
trying to get that cache thingi work
This commit is contained in:
@@ -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]);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ final class MagdevRedmineExtension extends Extension
|
||||
$container->register($id, RedmineClient::class)
|
||||
->addMethodCall('setUrl', [$connection['url']])
|
||||
->addMethodCall('setApiKey', [$connection['apikey']]);
|
||||
|
||||
$container->registerAliasForArgument($id, RedmineClient::class, "{$name}Client");
|
||||
|
||||
if ($name === $config['default_connection']) {
|
||||
|
||||
Reference in New Issue
Block a user