-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranslationCacheInterface.php
More file actions
46 lines (37 loc) · 1.28 KB
/
TranslationCacheInterface.php
File metadata and controls
46 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Tmi\TranslationBundle\Translation\Cache;
use Tmi\TranslationBundle\Doctrine\Model\TranslatableInterface;
/**
* Abstraction for translation caching and circular-reference detection.
*
* Implementations store translated entities keyed by tuuid+locale and track
* in-progress translations to prevent infinite recursion.
*/
interface TranslationCacheInterface
{
/**
* Check if a translation exists in cache.
*/
public function has(string $tuuid, string $locale): bool;
/**
* Get a cached translation. Returns null if not cached.
*/
public function get(string $tuuid, string $locale): TranslatableInterface|null;
/**
* Store a translation in cache.
*/
public function set(string $tuuid, string $locale, TranslatableInterface $entity): void;
/**
* Mark a tuuid+locale as currently being translated (cycle detection).
*/
public function markInProgress(string $tuuid, string $locale): void;
/**
* Remove the in-progress mark for a tuuid+locale.
*/
public function unmarkInProgress(string $tuuid, string $locale): void;
/**
* Check if a tuuid+locale is currently being translated.
*/
public function isInProgress(string $tuuid, string $locale): bool;
}