-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cache flag if translations needs to be reloaded
- Loading branch information
Showing
10 changed files
with
116 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arxy\TranslationsBundle; | ||
|
||
use Psr\Cache\CacheItemInterface; | ||
use Psr\Cache\CacheItemPoolInterface; | ||
|
||
final readonly class CacheFlag | ||
{ | ||
public function __construct( | ||
private CacheItemPoolInterface $cache, | ||
private string $key = 'translations' | ||
) { | ||
} | ||
|
||
public function getVersion(): CacheItemInterface | ||
{ | ||
$item = $this->cache->getItem($this->key); | ||
if (!$item->isHit()) { | ||
$item->set(0); | ||
} | ||
|
||
return $item; | ||
} | ||
|
||
public function increment(CacheItemInterface $item): void | ||
{ | ||
$item->set($item->get() + 1); | ||
$this->cache->save($item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/* | ||
* Copyright (C) 2016-2024 Taylor & Hart Limited | ||
* All Rights Reserved. | ||
* | ||
* NOTICE: All information contained herein is, and remains the property | ||
* of Taylor & Hart Limited and its suppliers, if any. | ||
* | ||
* All intellectual and technical concepts contained herein are | ||
* proprietary to Taylor & Hart Limited and its suppliers and may be | ||
* covered by U.K. and foreign patents, patents in process, and are | ||
* protected in full by copyright law. Dissemination of this information | ||
* or reproduction of this material is strictly forbidden unless prior | ||
* written permission is obtained from Taylor & Hart Limited. | ||
* | ||
* ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE, OR | ||
* PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE | ||
* EXPRESS WRITTEN CONSENT OF RARE PINK LIMITED IS STRICTLY PROHIBITED, | ||
* AND IN VIOLATION OF APPLICABLE LAWS. THE RECEIPT OR POSSESSION OF | ||
* THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY | ||
* ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO | ||
* MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR | ||
* IN PART. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Arxy\TranslationsBundle\CacheFlag; | ||
use Arxy\TranslationsBundle\Dumper\DatabaseDumper; | ||
use Arxy\TranslationsBundle\Repository; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$services = $container->services() | ||
->defaults() | ||
->autoconfigure() | ||
->autowire(); | ||
|
||
$services->set(DatabaseDumper::class)->args([ | ||
service(Repository::class), | ||
]) | ||
->tag('translation.dumper', ['alias' => 'db']); | ||
|
||
$services->set(CacheFlag::class); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters