Skip to content

Commit 741145a

Browse files
committed
OXDEV-8670 Separate schema caches per subshop
1 parent 94c7a34 commit 741145a

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

services.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ services:
117117
OxidEsales\GraphQL\Base\Event\Subscriber\BeforeTokenCreationSubscriber:
118118
tags: [ 'kernel.event_subscriber' ]
119119

120+
OxidEsales\GraphQL\Base\Framework\FilesystemAdapterFactory:
121+
class: OxidEsales\GraphQL\Base\Framework\FilesystemAdapterFactory
122+
120123
oxidesales.graphqlbase.cacheadapter:
121124
class: Symfony\Component\Cache\Adapter\FilesystemAdapter
122-
arguments:
123-
$namespace: 'oe_graphql_base-schema'
124-
$directory: '@=service("OxidEsales\\EshopCommunity\\Internal\\Transition\\Utility\\ContextInterface").getCacheDirectory()'
125+
factory: ['@OxidEsales\GraphQL\Base\Framework\FilesystemAdapterFactory', 'create']
125126

126127
oxidesales.graphqlbase.cache:
127128
class: Symfony\Component\Cache\Psr16Cache
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace OxidEsales\GraphQL\Base\Framework;
11+
12+
use OxidEsales\EshopCommunity\Internal\Transition\Utility\ContextInterface;
13+
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
14+
use Symfony\Component\Filesystem\Path;
15+
16+
readonly class FilesystemAdapterFactory
17+
{
18+
public function __construct(private ContextInterface $context)
19+
{
20+
}
21+
22+
/** @SuppressWarnings(PHPMD.StaticAccess) */
23+
public function create(): FilesystemAdapter
24+
{
25+
$path = Path::join(
26+
$this->context->getCacheDirectory(),
27+
'oe_graphql_base-schema',
28+
(string)$this->context->getCurrentShopId()
29+
);
30+
return new FilesystemAdapter(directory: $path);
31+
}
32+
}

0 commit comments

Comments
 (0)